-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from opengento/program
Program
- Loading branch information
Showing
12 changed files
with
273 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import React from "react"; | ||
import Container from "@/layouts/Container"; | ||
import BackgroundImage from "../BackgroundImage/BackgroundImage"; | ||
import ProgramList from "./ProgramList"; | ||
|
||
const Program = () => { | ||
return ( | ||
<BackgroundImage | ||
imagePath="/images/background/sponsors.png" | ||
className="py-12" | ||
> | ||
<Container size="large"> | ||
<div className="program"> | ||
<ProgramList /> | ||
</div> | ||
</Container> | ||
</BackgroundImage> | ||
); | ||
}; | ||
|
||
export default Program; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
import React from "react"; | ||
import TopBanner from "../TopBanner/TopBanner"; | ||
import ButtonLink from "../ButtonLink/ButtonLink"; | ||
import { Swiper, SwiperClass, SwiperSlide } from "swiper/react"; | ||
import { Navigation } from "swiper/modules"; | ||
import "swiper/css"; | ||
import "swiper/css/navigation"; | ||
import useDataProvider from "@/hooks/useDataProvider"; | ||
import ClientOnly from "@/helpers/ClientOnly"; | ||
import ProgramTile from "./ProgramTile"; | ||
|
||
const ProgramList = () => { | ||
const swiperRef = React.useRef<SwiperClass>(null); | ||
const sessions = useDataProvider().useSessions(); | ||
|
||
const handlePrev = () => { | ||
if (swiperRef.current) { | ||
swiperRef.current.slidePrev(); | ||
} | ||
}; | ||
|
||
const handleNext = () => { | ||
if (swiperRef.current) { | ||
swiperRef.current.slideNext(); | ||
} | ||
}; | ||
return ( | ||
<section className="program-list"> | ||
<div className="mb-8"> | ||
<TopBanner | ||
title="Extrait du Programme" | ||
onNextClick={handleNext} | ||
onPrevClick={handlePrev} | ||
> | ||
<> | ||
<div className="md:hidden"> | ||
<ButtonLink variant="secondary-invert" href={"/program"}> | ||
Voir tout | ||
</ButtonLink> | ||
</div> | ||
<div className="hidden md:block"> | ||
<ButtonLink variant="secondary-invert" href={"/program"}> | ||
Découvrir le Programme | ||
</ButtonLink> | ||
</div> | ||
</> | ||
</TopBanner> | ||
</div> | ||
<ClientOnly> | ||
<Swiper | ||
onSwiper={(swiper) => { | ||
swiperRef.current = swiper; | ||
}} | ||
modules={[Navigation]} | ||
spaceBetween={30} | ||
breakpoints={{ | ||
0: { | ||
slidesPerView: 1, | ||
spaceBetween: 16, | ||
}, | ||
768: { | ||
slidesPerView: 2, | ||
}, | ||
1024: { | ||
slidesPerView: 3, | ||
}, | ||
}} | ||
className="relative" | ||
> | ||
{sessions.map((session) => ( | ||
<SwiperSlide key={session.id} className="!h-auto"> | ||
<ProgramTile session={session} /> | ||
</SwiperSlide> | ||
))} | ||
</Swiper> | ||
</ClientOnly> | ||
</section> | ||
); | ||
}; | ||
|
||
export default ProgramList; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import React from "react"; | ||
import { SessionProps } from "../Speakers/Session/SessionProps"; | ||
import Session from "../Speakers/Session/Session"; | ||
import { PiCalendarPlus } from "react-icons/pi"; | ||
import Person from "../Person/Person"; | ||
import useDataProvider from "@/hooks/useDataProvider"; | ||
|
||
const ProgramTile = ({ session }: { session: SessionProps }) => { | ||
const dataProvider = useDataProvider(); | ||
const speakers = dataProvider | ||
.usePersonList("speakers", "data.speakers") | ||
.filter((speaker) => session.speakers.includes(speaker.id)); | ||
|
||
return ( | ||
<div className="program-tile bg-white rounded-xl flex flex-col justify-between gap-6 p-4 md:p-6 h-full group"> | ||
<div className="flex flex-col gap-6"> | ||
<Session session={session} /> | ||
<div className="program-tile-speakers flex flex-col gap-2"> | ||
{speakers.map((speaker) => ( | ||
<Person person={speaker} appearance="program" key={speaker.id} /> | ||
))} | ||
</div> | ||
</div> | ||
<div className="flex justify-center"> | ||
<div className="flex flex-row items-center gap-1 bg-primary px-4 py-2 rounded-full lg:opacity-0 lg:group-hover:opacity-100 lg:transition-opacity lg:duration-300 lg:hover:cursor-pointer"> | ||
<PiCalendarPlus size={20} className="text-white" /> | ||
<span className="text-sm text-white font-semibold"> | ||
Ajouter à mon agenda | ||
</span> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default ProgramTile; |
Oops, something went wrong.