Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions app/components/HeroCarousel.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import type React from 'react';
import {useEffect, useState} from 'react';
import {cn} from '~/lib/utils';

interface CarouselProps {
items: React.ReactNode[];
autoPlay?: boolean;
autoPlayInterval?: number;
}

export default function HeroCarousel({
items,
autoPlay,
autoPlayInterval,
}: CarouselProps) {
const [currentIndex, setCurrentIndex] = useState(0);

const goToSlide = (index: number) => {
setCurrentIndex(index);
};

useEffect(() => {
if (!autoPlay) return; // Only run if autoplay is enabled

const interval = setInterval(() => {
setCurrentIndex((prev) => (prev + 1) % items.length);
}, autoPlayInterval);

return () => clearInterval(interval); // Cleanup on unmount
}, [autoPlay, autoPlayInterval, items.length]);

return (
<div className="relative w-full">
{/* Carousel Content */}
<div className="overflow-hidden rounded-lg">
<div
className="flex transition-transform duration-500 ease-out"
style={{transform: `translateX(-${currentIndex * 100}%)`}}
>
{items.map((item, index) => (
<div key={index} className="min-w-full">
{item}
</div>
))}
</div>
</div>

{/* Dot Navigation */}
<div className="absolute bottom-4 left-1/2 -translate-x-1/2 flex gap-2">
{items.map((_, index) => (
<button
key={index}
onClick={() => goToSlide(index)}
className={cn(
'h-2 rounded-full transition-all duration-300',
currentIndex === index
? 'w-8 bg-primary'
: 'w-2 bg-primary/30 hover:bg-primary/50',
)}
aria-label={`Go to slide ${index + 1}`}
/>
))}
</div>
</div>
);
}
2 changes: 1 addition & 1 deletion app/components/PageLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export function PageLayout({
publicStoreDomain={publicStoreDomain}
/>
)}
<main className="mb-auto">{children}</main>
<main className="main-container mb-auto">{children}</main>
<Footer
footer={footer}
header={header}
Expand Down
60 changes: 60 additions & 0 deletions app/components/shadcn/button.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import * as React from "react"
import { Slot } from "@radix-ui/react-slot"
import { cva, type VariantProps } from "class-variance-authority"

import { cn } from "~/lib/utils"

const buttonVariants = cva(
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
{
variants: {
variant: {
default: "bg-primary text-primary-foreground hover:bg-primary/90",
destructive:
"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
outline:
"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
secondary:
"bg-secondary text-secondary-foreground hover:bg-secondary/80",
ghost:
"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
link: "text-primary underline-offset-4 hover:underline",
},
size: {
default: "h-9 px-4 py-2 has-[>svg]:px-3",
sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
icon: "size-9",
"icon-sm": "size-8",
"icon-lg": "size-10",
},
},
defaultVariants: {
variant: "default",
size: "default",
},
}
)

function Button({
className,
variant,
size,
asChild = false,
...props
}: React.ComponentProps<"button"> &
VariantProps<typeof buttonVariants> & {
asChild?: boolean
}) {
const Comp = asChild ? Slot : "button"

return (
<Comp
data-slot="button"
className={cn(buttonVariants({ variant, size, className }))}
{...props}
/>
)
}

export { Button, buttonVariants }
92 changes: 92 additions & 0 deletions app/components/shadcn/card.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
import * as React from "react"

import { cn } from "~/lib/utils"

function Card({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
data-slot="card"
className={cn(
"bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",
className
)}
{...props}
/>
)
}

function CardHeader({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
data-slot="card-header"
className={cn(
"@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",
className
)}
{...props}
/>
)
}

function CardTitle({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
data-slot="card-title"
className={cn("leading-none font-semibold", className)}
{...props}
/>
)
}

function CardDescription({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
data-slot="card-description"
className={cn("text-muted-foreground text-sm", className)}
{...props}
/>
)
}

function CardAction({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
data-slot="card-action"
className={cn(
"col-start-2 row-span-2 row-start-1 self-start justify-self-end",
className
)}
{...props}
/>
)
}

function CardContent({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
data-slot="card-content"
className={cn("px-6", className)}
{...props}
/>
)
}

function CardFooter({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
data-slot="card-footer"
className={cn("flex items-center px-6 [.border-t]:pt-6", className)}
{...props}
/>
)
}

export {
Card,
CardHeader,
CardFooter,
CardTitle,
CardAction,
CardDescription,
CardContent,
}
Loading
Loading