Skip to content

Commit

Permalink
second draft
Browse files Browse the repository at this point in the history
  • Loading branch information
Tschonti committed Jan 29, 2024
1 parent 2ef979d commit 1c89ae0
Showing 1 changed file with 13 additions and 22 deletions.
35 changes: 13 additions & 22 deletions src/components/image-carousel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,33 +14,24 @@ type Props = {
data: PrevConfData;
};

function getIndexBound() {
if (window.innerWidth < 650) return 1;
if (window.innerWidth < 1000) return 2;
if (window.innerWidth < 1350) return 3;
return 4;
}

export function ImageCarousel({ data: { conferences, sectionTitle } }: Props) {
const [index, setIndex] = useState(-1);
const images = conferences[0].imageUrls;
return (
<div className='my-40 '>
<div className='my-40'>
<h2 className='flex justify-center mb-4'>{sectionTitle}</h2>
<div className='flex gap-6 justify-center w-full max-w-6xl'>
{images
.filter((_, i) => i < getIndexBound())
.map((imageUrl, idx) => (
<Image
onClick={() => setIndex(idx)}
src={imageUrl}
key={imageUrl}
alt='Kép korábbi konferenciáról'
className='h-full cursor-pointer'
height={225}
width={300}
/>
))}
<div className='flex gap-6 w-full max-w-6xl overflow-hidden px-6 xl:px-0'>
{images.map((imageUrl, idx) => (
<Image
onClick={() => setIndex(idx)}
src={imageUrl}
key={imageUrl}
alt='Kép korábbi konferenciáról'
className='h-full cursor-pointer'
height={225}
width={300}
/>
))}
</div>
<Lightbox
open={index > -1}
Expand Down

0 comments on commit 1c89ae0

Please sign in to comment.