Skip to content

Commit

Permalink
resized images on mobile
Browse files Browse the repository at this point in the history
  • Loading branch information
MariaBonde committed Aug 28, 2024
1 parent b32b3ce commit 6181b2e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pages/api/files.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {utapi} from '../../src/server/uploadthing'

export default async function handler(req:any, res:any) {
export default async function handler(_:any, res:any) {
const data = await utapi.listFiles();
res.status(200).json(data);
}
2 changes: 1 addition & 1 deletion src/hemsedal24/bilder.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ html {
@media (max-width: 500px) {
.embla__slide {
max-width: 120%;
flex: 0 0 100%;
flex: 0 0 75%;
}
.embla {
width: 100%;
Expand Down
5 changes: 2 additions & 3 deletions src/hemsedal24/components/Files.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,22 @@ export default function Files({ data }: any) {
};

const [emblaRef] = useEmblaCarousel({loop: true, skipSnaps:true, startIndex:startIndex});
console.log(data)
return (
<div className={styles.viewPort}>

{data.files.length > 0 ?
<div id="pictureContainer" className={styles.container}>
{data.files.map((file:any, index:number) =>
<div key={file.id} className={styles.image} onClick={()=>imageClicked(file.id, index)}>

Check failure on line 29 in src/hemsedal24/components/Files.tsx

View workflow job for this annotation

GitHub Actions / eslint

Visible, non-interactive elements with click handlers must have at least one keyboard listener

Check failure on line 29 in src/hemsedal24/components/Files.tsx

View workflow job for this annotation

GitHub Actions / eslint

Avoid non-native interactive elements. If using native HTML is not possible, add an appropriate role and support for tabbing, mouse, keyboard, and touch inputs to an interactive content element
<img src={`https://utfs.io/f/${file.key}`} alt={`image of ${file.name}`}/></div>)} </div> :<div className={styles.nopictures}><h4>Ingen bilder ennå!</h4></div>}
<img src={`https://utfs.io/f/${file.key}`} alt={` ${file.name}`}/></div>)} </div> :<div className={styles.nopictures}><h4>Ingen bilder ennå!</h4></div>}

{isPopoverOpen && (
<Popover onClose={closePopoever}>
<div className={styles.embla} ref={emblaRef}>
<div className={styles.embla__container}>
{data.files.map((file:any) =>
<div key = {file.id} className={styles.embla__slide}>
<img src={`https://utfs.io/f/${file.key}`} alt={`image of ${file.name}`}/>
<img src={`https://utfs.io/f/${file.key}`} alt={`${file.name}`}/>
</div>
)}
</div>
Expand Down

0 comments on commit 6181b2e

Please sign in to comment.