mirror of
https://github.com/hanzoai/shadcn.git
synced 2026-10-30 18:22:59 +00:00
Squash merge of shadcn-ui/ui main branch into hanzo/ui, bringing in: - [email protected] through [email protected] releases - New apps/v4 directory structure - Registry system improvements and MCP server - Framework support (Vue, Svelte, React Native) - New templates (vite-app, monorepo-next, laravel) - Zod 4 compatibility (scoped override for zod@>4) - Test fixture corrections for alias resolution All 867 merge conflicts resolved preserving Hanzo customizations. 1020/1020 shadcn tests pass.
100 lines
3.0 KiB
TypeScript
100 lines
3.0 KiB
TypeScript
import {
|
|
Example,
|
|
ExampleWrapper,
|
|
} from "@/registry/bases/base/components/example"
|
|
import { Card, CardContent } from "@/registry/bases/base/ui/card"
|
|
import {
|
|
Carousel,
|
|
CarouselContent,
|
|
CarouselItem,
|
|
CarouselNext,
|
|
CarouselPrevious,
|
|
} from "@/registry/bases/base/ui/carousel"
|
|
|
|
export default function CarouselExample() {
|
|
return (
|
|
<ExampleWrapper className="lg:grid-cols-1">
|
|
<CarouselBasic />
|
|
<CarouselMultiple />
|
|
<CarouselWithGap />
|
|
</ExampleWrapper>
|
|
)
|
|
}
|
|
|
|
function CarouselBasic() {
|
|
return (
|
|
<Example title="Basic">
|
|
<Carousel className="mx-auto max-w-xs sm:max-w-sm">
|
|
<CarouselContent>
|
|
{Array.from({ length: 5 }).map((_, index) => (
|
|
<CarouselItem key={index}>
|
|
<div className="p-1">
|
|
<Card>
|
|
<CardContent className="flex aspect-square items-center justify-center p-6">
|
|
<span className="text-4xl font-semibold">{index + 1}</span>
|
|
</CardContent>
|
|
</Card>
|
|
</div>
|
|
</CarouselItem>
|
|
))}
|
|
</CarouselContent>
|
|
<CarouselPrevious className="hidden sm:inline-flex" />
|
|
<CarouselNext className="hidden sm:inline-flex" />
|
|
</Carousel>
|
|
</Example>
|
|
)
|
|
}
|
|
|
|
function CarouselMultiple() {
|
|
return (
|
|
<Example title="Multiple">
|
|
<Carousel
|
|
className="mx-auto max-w-xs sm:max-w-sm"
|
|
opts={{
|
|
align: "start",
|
|
}}
|
|
>
|
|
<CarouselContent>
|
|
{Array.from({ length: 5 }).map((_, index) => (
|
|
<CarouselItem key={index} className="sm:basis-1/2 lg:basis-1/3">
|
|
<div className="p-1">
|
|
<Card>
|
|
<CardContent className="flex aspect-square items-center justify-center p-6">
|
|
<span className="text-3xl font-semibold">{index + 1}</span>
|
|
</CardContent>
|
|
</Card>
|
|
</div>
|
|
</CarouselItem>
|
|
))}
|
|
</CarouselContent>
|
|
<CarouselPrevious className="hidden sm:inline-flex" />
|
|
<CarouselNext className="hidden sm:inline-flex" />
|
|
</Carousel>
|
|
</Example>
|
|
)
|
|
}
|
|
|
|
function CarouselWithGap() {
|
|
return (
|
|
<Example title="With Gap">
|
|
<Carousel className="mx-auto max-w-xs sm:max-w-sm">
|
|
<CarouselContent className="-ml-1">
|
|
{Array.from({ length: 5 }).map((_, index) => (
|
|
<CarouselItem key={index} className="pl-1 md:basis-1/2">
|
|
<div className="p-1">
|
|
<Card>
|
|
<CardContent className="flex aspect-square items-center justify-center p-6">
|
|
<span className="text-2xl font-semibold">{index + 1}</span>
|
|
</CardContent>
|
|
</Card>
|
|
</div>
|
|
</CarouselItem>
|
|
))}
|
|
</CarouselContent>
|
|
<CarouselPrevious className="hidden sm:inline-flex" />
|
|
<CarouselNext className="hidden sm:inline-flex" />
|
|
</Carousel>
|
|
</Example>
|
|
)
|
|
}
|