From eb7d2ff2f642a2fd0b0debe7eaa74acad996d00a Mon Sep 17 00:00:00 2001 From: John Nguyen Date: Thu, 30 Oct 2025 23:17:01 -0700 Subject: [PATCH 1/3] added dot carousel to index page --- app/components/HeroCarousel.tsx | 68 +++++++++ app/components/PageLayout.tsx | 2 +- app/components/shadcn/button.tsx | 60 ++++++++ app/components/shadcn/card.tsx | 92 ++++++++++++ app/routes/_index.tsx | 235 +++++++++---------------------- app/routes/_index_old.tsx | 183 ++++++++++++++++++++++++ package-lock.json | 29 ++++ package.json | 5 +- 8 files changed, 500 insertions(+), 174 deletions(-) create mode 100644 app/components/HeroCarousel.tsx create mode 100644 app/components/shadcn/button.tsx create mode 100644 app/components/shadcn/card.tsx create mode 100644 app/routes/_index_old.tsx diff --git a/app/components/HeroCarousel.tsx b/app/components/HeroCarousel.tsx new file mode 100644 index 0000000..607c8d0 --- /dev/null +++ b/app/components/HeroCarousel.tsx @@ -0,0 +1,68 @@ +import type React from 'react'; +import {useState} from 'react'; +import {cn} from '~/lib/utils'; + +interface CarouselProps { + items: React.ReactNode[]; + autoPlay?: boolean; + autoPlayInterval?: number; +} + +export default function HeroCarousel({ + items, + autoPlay = false, + autoPlayInterval = 3000, +}: CarouselProps) { + const [currentIndex, setCurrentIndex] = useState(0); + + const goToSlide = (index: number) => { + setCurrentIndex(index); + }; + + const goToPrevious = () => { + setCurrentIndex((prevIndex) => + prevIndex === 0 ? items.length - 1 : prevIndex - 1, + ); + }; + + const goToNext = () => { + setCurrentIndex((prevIndex) => + prevIndex === items.length - 1 ? 0 : prevIndex + 1, + ); + }; + + return ( +
+ {/* Carousel Content */} +
+
+ {items.map((item, index) => ( +
+ {item} +
+ ))} +
+
+ + {/* Dot Navigation */} +
+ {items.map((_, index) => ( +
+
+ ); +} diff --git a/app/components/PageLayout.tsx b/app/components/PageLayout.tsx index e7e6626..fe5f083 100644 --- a/app/components/PageLayout.tsx +++ b/app/components/PageLayout.tsx @@ -45,7 +45,7 @@ export function PageLayout({ publicStoreDomain={publicStoreDomain} /> )} -
{children}
+
{children}