Skip to content

Commit

Permalink
picture loading is slow, attempting to fix (#536)
Browse files Browse the repository at this point in the history
  • Loading branch information
MariaBonde authored Aug 28, 2024
1 parent 304e574 commit 88eacb8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/hemsedal24/bilder.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ html {
}
.container {
margin-bottom: 4rem;
grid-template-columns: repeat(3, 1fr);
}

.uploadDropZone {
Expand Down
5 changes: 2 additions & 3 deletions src/hemsedal24/bilder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default function Bilder() {
console.log(data);
setFilesData(data);
};

console.log((width/21)+(((width / 100) | 0)/4))
const [filesData, setFilesData] = useState(null);
useEffect(() => {
fetchFiles();
Expand All @@ -40,8 +40,7 @@ export default function Bilder() {
<span>Tilbake</span>
</Link>
<div id="header" className={styles.header}>
<h3>{mobile ? `Bild${'e'.repeat((width/21.1))}r 📸` : 'Bildeeeeeeeeeeeeeeeeeeeer 📸'}</h3>

<h3>{mobile ? `Bild${'e'.repeat((width/24))}r 📸` : 'Bildeeeeeeeeeeeeeeeeeeeer 📸'}</h3>
<div className={styles.uploadDropZone}>
<UploadButton
className={`${styles.customButton}`}
Expand Down
4 changes: 2 additions & 2 deletions src/hemsedal24/components/Files.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ export default function Files({ data }: any) {
<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)} tabIndex={0} role="button" aria-label='open picture' onKeyDown={()=>imageClicked(file.id, index)}>
<img src={`https://utfs.io/f/${file.key}`} alt={` ${file.name}`}/></div>)} </div> :<div className={styles.nopictures}><h4>Ingen bilder ennå!</h4></div>}
<img loading="lazy" 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={`${file.name}`}/>
<img loading="lazy" src={`https://utfs.io/f/${file.key}`} alt={`${file.name}`}/>
</div>
)}
</div>
Expand Down

0 comments on commit 88eacb8

Please sign in to comment.