Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

picture loading is slow, attempting to fix #536

Merged
merged 1 commit into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading