Skip to content

Commit

Permalink
add carousel
Browse files Browse the repository at this point in the history
  • Loading branch information
MaggieYang57 committed Aug 1, 2023
1 parent 24b4445 commit 6fbd717
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
10 changes: 5 additions & 5 deletions components/Carousel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,27 @@ const Carousel = (props: CarouselProps) => {

return (
<div className="flex justify-between">
<div className="hidden md:block my-auto w-16 h-16 rounded-full bg-blue text-white">
<div className="hidden md:block my-auto w-16 h-16 rounded-full text-blue">
<ChevronLeftIcon className="h-16 w-12 cursor-pointer mx-auto" onClick={() => updateIndex(-1)} />
</div>
<div className="md:w-4/5">
{children[slideIndex]}
<div className="flex justify-center space-x-2 mt-2">
<div className="md:hidden my-auto w-8 h-8 rounded-full bg-blue text-white">
<div className="md:hidden my-auto w-8 h-8 rounded-full text-blue">
<ChevronLeftIcon className="h-8 w-6 cursor-pointer mx-auto" onClick={() => updateIndex(-1)} />
</div>
{children.map((_, i) => {
const outlineCircle = 'w-5 h-5 border-2 border-blue rounded-full cursor-pointer self-center';
const outlineCircle = 'w-4 h-4 mt-3 border-2 border-blue rounded-full cursor-pointer self-center';
const circle = i === slideIndex ? `${outlineCircle} bg-blue` : outlineCircle;
// eslint-disable-next-line react/no-array-index-key
return <div key={i} className={circle} onClick={() => setSlideIndex(i)} aria-hidden="true">&nbsp;</div>;
})}
<div className="md:hidden my-auto w-8 h-8 rounded-full bg-blue text-white">
<div className="md:hidden my-auto w-8 h-8 rounded-full text-blue">
<ChevronRightIcon className="h-8 w-6 cursor-pointer mx-auto" onClick={() => updateIndex(1)} />
</div>
</div>
</div>
<div className="hidden md:block my-auto w-16 h-16 rounded-full bg-blue text-white">
<div className="hidden md:block my-auto w-16 h-16 rounded-full text-blue">
<ChevronRightIcon className="h-16 w-12 cursor-pointer mx-auto" onClick={() => updateIndex(1)} />
</div>
</div>
Expand Down
7 changes: 6 additions & 1 deletion pages/about.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { InfoCardItem, MemberCardItem } from '../utils/types';
import ImageCard from '../components/ImageCard';
import MemberCard from '../components/MemberCard';
import InfoCard from '../components/InfoCard';
import Carousel from '../components/Carousel';

interface AboutProps {
page: {
Expand Down Expand Up @@ -37,7 +38,11 @@ const About = (props: AboutProps) => {
<p>{page.description}</p>
</section>

<ImageCard img="/photos/showcase-2019.png" alt="Club Showcase 2019" />
<Carousel>
<ImageCard img="/photos/showcase-2019.png" alt="Club Showcase 2019" />
<ImageCard img="/photos/beach-cleanup.jpg" alt="Beach Cleanup 2022" />
<ImageCard img="/photos/outlook.jpg" alt="Outlook from the P" />
</Carousel>

<section className="flow-root space-y-6 md:space-y-10">
<h2>Our events</h2>
Expand Down
Binary file added public/photos/beach-cleanup.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/photos/outlook.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 6fbd717

Please sign in to comment.