Skip to content

Commit

Permalink
picture page ready
Browse files Browse the repository at this point in the history
  • Loading branch information
MariaBonde committed Aug 28, 2024
1 parent 226d89c commit 58fa0a1
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 22 deletions.
83 changes: 79 additions & 4 deletions src/hemsedal24/bilder.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
}
.tilbake {
color: var(--color-standard__black);
margin-top: 2rem;
margin-bottom: 2rem;
width: 30%;
z-index: 1;
Expand Down Expand Up @@ -56,11 +55,15 @@
border-radius: 6.25rem;
background-image: url('./images/Knapp.svg');
background-size: cover;
--tw-ring-color: transparent;
}

.customButton > *[data-ut-element='button']:hover {
background-image: url('./images/knapp2.svg');
}
.customButton > *[data-ut-element='button']:focus-within {
--tw-ring-color: transparent;
}

/* applied to button when uploading */
.customButton > *[data-ut-element='button'][data-state='readying'] {
Expand All @@ -70,6 +73,7 @@
background-size: cover;
color: rgb(0 0 0 / 0.5);
cursor: not-allowed;
--tw-ring-color: transparent;
}

/* applied to the button when uploading */
Expand All @@ -80,11 +84,13 @@
background-size: cover;
color: rgb(0 0 0 / 0.5);
cursor: not-allowed;
--tw-ring-color: transparent;
}

/* applied to the upload indicator when uploading */
.customButton > *[data-ut-element='button'][data-state='uploading']::after {
background-color: rgb(245 164 196 / 1);
--tw-ring-color: transparent;
}

.customButton > *[data-ut-element='allowed-content'] {
Expand Down Expand Up @@ -162,6 +168,7 @@ html {
flex-shrink: 0;
display: flex;
justify-content: center;
align-items: center;
width: 25rem;
z-index: 10;
margin: 0 auto;
Expand All @@ -171,11 +178,79 @@ html {
/* Or another appropriate value */
height: auto; /* Maintain aspect ratio */
}

.nopictures {
height: 40rem;
display: flex;
justify-content: center;
align-items: center;
}
@media (max-width: 500px) {
.embla__slide {
max-width: 120%;
flex: 0 0 100%;
}
.embla {
width: 100%;
margin: 0;
}
.embla__container {
height: auto;
width: 100vw;
}
.main {
width: 85vh;
display: flex;
justify-content: center;
flex-direction: column;
}
.embla__slide {
max-width: 70%;
.container {
margin-bottom: 4rem;
}

.uploadDropZone {
position: fixed;
bottom: 5%;
left: 50%;
transform: translateX(-50%);
display: flex;
justify-content: center;
align-items: center;
z-index: 20;
width: auto;
padding: 0;
margin: 0;
}
.customButton {
align-items: center;
justify-content: center;
}

.customButton > *[data-ut-element='button'] {
width: 19.5rem;
height: 3.375rem;
}

.customButton > *[data-ut-element='button'][data-state='readying'],
.customButton > *[data-ut-element='button'][data-state='uploading'] {
width: 19.5rem;
}

.header {
width: 100%;
}
.header h3 {
font-size: 25px;
line-height: 2.4375rem;
-webkit-font-smoothing: antialiased; /* Improves rendering in WebKit browsers */
-moz-osx-font-smoothing: grayscale;
}
.header > .uploadDropZone {
width: 100%;
}

@-moz-document url-prefix() {
.uploadDropZone {
margin-bottom: 1rem;
}
}
}
10 changes: 6 additions & 4 deletions src/hemsedal24/bilder.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { UploadDropzone, UploadButton } from '../../src/utils/uploadthing';
import { UploadButton } from '../../src/utils/uploadthing';

Check failure on line 1 in src/hemsedal24/bilder.tsx

View workflow job for this annotation

GitHub Actions / tsc

'res' is declared but its value is never read.
import styles from './bilder.module.css';
import React, { useEffect, useState } from 'react';
import Files from './components/Files';
Expand All @@ -9,9 +9,10 @@ import arrowLeft from './images/arrow-left.svg'

export default function Bilder() {
const [mobile, setMobile] = useState(false);

const [width, setWidth] = useState(0)
useEffect(() => {
const handleWindowSizeChange = () => {
setWidth(window.innerWidth)
setMobile(window.innerWidth <= 500);
};

Expand Down Expand Up @@ -39,7 +40,7 @@ export default function Bilder() {
<span>Tilbake</span>
</Link>
<div id="header" className={styles.header}>
<h3>Bildeeeeeeeeeeeeeeeeeeeer 📸</h3>
<h3>{mobile ? `Bild${'e'.repeat((width/21.1))}r 📸` : 'Bildeeeeeeeeeeeeeeeeeeeer 📸'}</h3>

<div className={styles.uploadDropZone}>
<UploadButton
Expand All @@ -60,11 +61,12 @@ export default function Bilder() {
<Files data={filesData} />
</div>
)}
{mobile ? <></> :
<a href="#header">
<div className={styles.bop}>
<img src={bop} alt="big blobs" />
</div>
</a>
</a>}
</main>
);
}
18 changes: 4 additions & 14 deletions src/hemsedal24/components/Files.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,16 @@ export default function Files({ data }: any) {
};

const [emblaRef] = useEmblaCarousel({loop: true, skipSnaps:true, startIndex:startIndex});
const numFiles = data.files.length;
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 30 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 30 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>
<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>}

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

View workflow job for this annotation

GitHub Actions / eslint

Redundant alt attribute. Screen-readers already announce `img` tags as an image. You don’t need to use the words `image`, `photo,` or `picture` (or any specified custom words) in the alt prop

{isPopoverOpen && (
<Popover onClose={closePopoever}>
<div className={styles.embla} ref={emblaRef}>
Expand All @@ -44,15 +45,4 @@ export default function Files({ data }: any) {
)}
</div>
);


{/* <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 style={{maxWidth:"100%"}}src={`https://utfs.io/f/${file.key}`} alt={`image of ${file.name}`}/>
</div>
)}
</div>
</div> */}
}
6 changes: 6 additions & 0 deletions src/hemsedal24/components/Popover.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,9 @@
font-size: 1.5rem;
cursor: pointer;
}

@media (max-width: 500px) {
.backdrop {
padding: 3rem 0 0 0;
}
}

0 comments on commit 58fa0a1

Please sign in to comment.