mirror of
https://github.com/hanzoai/shadcn.git
synced 2026-10-30 18:22:59 +00:00
Major fixes: - Fixed wagmi/Web3 SSR errors by lazy-loading config in Web3Provider - Added SidebarProvider to sidebar-demo components - Added 'use client' to 14 demo files with hooks/state/event handlers - Temporarily disabled force-static on blocks page Build progress: 0 → 258/1035 pages (25%) before hitting /blocks error Remaining issue: - /blocks page has function-passing error during static generation Package versions confirmed: - React 19.2.0 ✅ - Next.js 16.0.0 ✅ - Tailwind CSS 4.1.14 ✅
56 lines
1.4 KiB
TypeScript
56 lines
1.4 KiB
TypeScript
"use client"
|
|
|
|
import * as React from "react"
|
|
|
|
import { Card, CardContent } from "@/registry/default/ui/card"
|
|
import {
|
|
Carousel,
|
|
CarouselContent,
|
|
CarouselItem,
|
|
CarouselNext,
|
|
CarouselPrevious,
|
|
type CarouselApi,
|
|
} from "@/registry/default/ui/carousel"
|
|
|
|
export default function CarouselDApiDemo() {
|
|
const [api, setApi] = React.useState<CarouselApi>()
|
|
const [current, setCurrent] = React.useState(0)
|
|
const [count, setCount] = React.useState(0)
|
|
|
|
React.useEffect(() => {
|
|
if (!api) {
|
|
return
|
|
}
|
|
|
|
setCount(api.scrollSnapList().length)
|
|
setCurrent(api.selectedScrollSnap() + 1)
|
|
|
|
api.on("select", () => {
|
|
setCurrent(api.selectedScrollSnap() + 1)
|
|
})
|
|
}, [api])
|
|
|
|
return (
|
|
<div>
|
|
<Carousel setApi={setApi} className="w-full max-w-xs">
|
|
<CarouselContent>
|
|
{Array.from({ length: 5 }).map((_, index) => (
|
|
<CarouselItem key={index}>
|
|
<Card>
|
|
<CardContent className="flex aspect-square items-center justify-center p-6">
|
|
<span className="text-4xl font-semibold">{index + 1}</span>
|
|
</CardContent>
|
|
</Card>
|
|
</CarouselItem>
|
|
))}
|
|
</CarouselContent>
|
|
<CarouselPrevious />
|
|
<CarouselNext />
|
|
</Carousel>
|
|
<div className="py-2 text-center text-sm text-muted-foreground">
|
|
Slide {current} of {count}
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|