docs: fix carousel page responsive issues and ordering docs as shadcn-ui
This commit is contained in:
parent
7dfab6a6e2
commit
a19085dc9b
|
|
@ -52,7 +52,7 @@ const { style } = useConfigStore()
|
|||
</div>
|
||||
</div>
|
||||
<div
|
||||
:class="cn('preview flex min-h-[350px] w-full justify-center p-6 lg:p-10', {
|
||||
:class="cn('preview flex min-h-[350px] w-full justify-center p-10 items-center', {
|
||||
'items-center': align === 'center',
|
||||
'items-start': align === 'start',
|
||||
'items-end': align === 'end',
|
||||
|
|
|
|||
|
|
@ -48,18 +48,6 @@ import {
|
|||
|
||||
## Examples
|
||||
|
||||
### Orientation
|
||||
|
||||
Use the `orientation` prop to set the orientation of the carousel.
|
||||
|
||||
<ComponentPreview name="CarouselOrientation" />
|
||||
|
||||
```vue
|
||||
<Carousel orientation="vertical | horizontal">
|
||||
...
|
||||
</Carousel>
|
||||
```
|
||||
|
||||
### Sizes
|
||||
|
||||
To set the size of the items, you can use the `basis` utility class on the `<CarouselItem />`.
|
||||
|
|
@ -151,6 +139,17 @@ Responsive
|
|||
</template>
|
||||
```
|
||||
|
||||
### Orientation
|
||||
|
||||
Use the `orientation` prop to set the orientation of the carousel.
|
||||
|
||||
<ComponentPreview name="CarouselOrientation" />
|
||||
|
||||
```vue
|
||||
<Carousel orientation="vertical | horizontal">
|
||||
...
|
||||
</Carousel>
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
|
|
@ -280,4 +279,4 @@ import Autoplay from 'embla-carousel-autoplay'
|
|||
|
||||
<ComponentPreview name="CarouselPlugin" />
|
||||
|
||||
See the [Embla Carousel docs](https://www.embla-carousel.com/api/plugins/) for more information on using plugins.
|
||||
See the [Embla Carousel docs](https://www.embla-carousel.com/api/plugins/) for more information on using plugins.
|
||||
|
|
|
|||
|
|
@ -27,8 +27,8 @@ watchOnce(api, (api) => {
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<div class="flex flex-col items-center space-x-2">
|
||||
<Carousel class="w-full max-w-xs" @init-api="setApi">
|
||||
<div class="w-full sm:w-auto">
|
||||
<Carousel class="relative w-full max-w-xs" @init-api="setApi">
|
||||
<CarouselContent>
|
||||
<CarouselItem v-for="(_, index) in 5" :key="index">
|
||||
<div class="p-1">
|
||||
|
|
|
|||
|
|
@ -4,21 +4,19 @@ import { Card, CardContent } from '@/lib/registry/default/ui/card'
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<div class="flex items-center space-x-2">
|
||||
<Carousel class="w-full max-w-xs">
|
||||
<CarouselContent>
|
||||
<CarouselItem v-for="(_, index) in 5" :key="index">
|
||||
<div class="p-1">
|
||||
<Card>
|
||||
<CardContent class="flex aspect-square items-center justify-center p-6">
|
||||
<span class="text-4xl font-semibold">{{ index + 1 }}</span>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
</CarouselItem>
|
||||
</CarouselContent>
|
||||
<CarouselPrevious />
|
||||
<CarouselNext />
|
||||
</Carousel>
|
||||
</div>
|
||||
<Carousel class="relative w-full max-w-xs">
|
||||
<CarouselContent>
|
||||
<CarouselItem v-for="(_, index) in 5" :key="index">
|
||||
<div class="p-1">
|
||||
<Card>
|
||||
<CardContent class="flex aspect-square items-center justify-center p-6">
|
||||
<span class="text-4xl font-semibold">{{ index + 1 }}</span>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
</CarouselItem>
|
||||
</CarouselContent>
|
||||
<CarouselPrevious />
|
||||
<CarouselNext />
|
||||
</Carousel>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -4,27 +4,25 @@ import { Card, CardContent } from '@/lib/registry/default/ui/card'
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<div class="w-1/2">
|
||||
<Carousel
|
||||
orientation="vertical"
|
||||
class="w-full max-w-xs"
|
||||
:opts="{
|
||||
align: 'start',
|
||||
}"
|
||||
>
|
||||
<CarouselContent class="-mt-1 h-[200px]">
|
||||
<CarouselItem v-for="(_, index) in 5" :key="index" class="p-1 md:basis-1/2">
|
||||
<div class="p-1">
|
||||
<Card>
|
||||
<CardContent class="flex items-center justify-center p-6">
|
||||
<span class="text-3xl font-semibold">{{ index + 1 }}</span>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
</CarouselItem>
|
||||
</CarouselContent>
|
||||
<CarouselPrevious />
|
||||
<CarouselNext />
|
||||
</Carousel>
|
||||
</div>
|
||||
<Carousel
|
||||
orientation="vertical"
|
||||
class="relative w-full max-w-xsw-full max-w-xs"
|
||||
:opts="{
|
||||
align: 'start',
|
||||
}"
|
||||
>
|
||||
<CarouselContent class="-mt-1 h-[200px]">
|
||||
<CarouselItem v-for="(_, index) in 5" :key="index" class="p-1 md:basis-1/2">
|
||||
<div class="p-1">
|
||||
<Card>
|
||||
<CardContent class="flex items-center justify-center p-6">
|
||||
<span class="text-3xl font-semibold">{{ index + 1 }}</span>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
</CarouselItem>
|
||||
</CarouselContent>
|
||||
<CarouselPrevious />
|
||||
<CarouselNext />
|
||||
</Carousel>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -11,26 +11,24 @@ const plugin = Autoplay({
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<div class="flex items-center space-x-2">
|
||||
<Carousel
|
||||
class="w-full max-w-xs"
|
||||
:plugins="[plugin]"
|
||||
@mouseenter="plugin.stop"
|
||||
@mouseleave="[plugin.reset(), plugin.play(), console.log('Runing')];"
|
||||
>
|
||||
<CarouselContent>
|
||||
<CarouselItem v-for="(_, index) in 5" :key="index">
|
||||
<div class="p-1">
|
||||
<Card>
|
||||
<CardContent class="flex aspect-square items-center justify-center p-6">
|
||||
<span class="text-4xl font-semibold">{{ index + 1 }}</span>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
</CarouselItem>
|
||||
</CarouselContent>
|
||||
<CarouselPrevious />
|
||||
<CarouselNext />
|
||||
</Carousel>
|
||||
</div>
|
||||
<Carousel
|
||||
class="relative w-full max-w-xs"
|
||||
:plugins="[plugin]"
|
||||
@mouseenter="plugin.stop"
|
||||
@mouseleave="[plugin.reset(), plugin.play(), console.log('Runing')];"
|
||||
>
|
||||
<CarouselContent>
|
||||
<CarouselItem v-for="(_, index) in 5" :key="index">
|
||||
<div class="p-1">
|
||||
<Card>
|
||||
<CardContent class="flex aspect-square items-center justify-center p-6">
|
||||
<span class="text-4xl font-semibold">{{ index + 1 }}</span>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
</CarouselItem>
|
||||
</CarouselContent>
|
||||
<CarouselPrevious />
|
||||
<CarouselNext />
|
||||
</Carousel>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -4,26 +4,24 @@ import { Card, CardContent } from '@/lib/registry/default/ui/card'
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<div class="flex items-center space-x-2">
|
||||
<Carousel
|
||||
class="w-full max-w-xs"
|
||||
:opts="{
|
||||
align: 'start',
|
||||
}"
|
||||
>
|
||||
<CarouselContent>
|
||||
<CarouselItem v-for="(_, index) in 5" :key="index" class="md:basis-1/2 lg:basis-1/3">
|
||||
<div class="p-1">
|
||||
<Card>
|
||||
<CardContent class="flex aspect-square items-center justify-center p-6">
|
||||
<span class="text-3xl font-semibold">{{ index + 1 }}</span>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
</CarouselItem>
|
||||
</CarouselContent>
|
||||
<CarouselPrevious />
|
||||
<CarouselNext />
|
||||
</Carousel>
|
||||
</div>
|
||||
<Carousel
|
||||
class="relative w-full max-w-sm"
|
||||
:opts="{
|
||||
align: 'start',
|
||||
}"
|
||||
>
|
||||
<CarouselContent>
|
||||
<CarouselItem v-for="(_, index) in 5" :key="index" class="md:basis-1/2 lg:basis-1/3">
|
||||
<div class="p-1">
|
||||
<Card>
|
||||
<CardContent class="flex aspect-square items-center justify-center p-6">
|
||||
<span class="text-3xl font-semibold">{{ index + 1 }}</span>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
</CarouselItem>
|
||||
</CarouselContent>
|
||||
<CarouselPrevious />
|
||||
<CarouselNext />
|
||||
</Carousel>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -4,26 +4,24 @@ import { Card, CardContent } from '@/lib/registry/default/ui/card'
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<div class="flex items-center space-x-2">
|
||||
<Carousel
|
||||
class="w-full max-w-sm"
|
||||
:opts="{
|
||||
align: 'start',
|
||||
}"
|
||||
>
|
||||
<CarouselContent class="-ml-1">
|
||||
<CarouselItem v-for="(_, index) in 5" :key="index" class="pl-1 md:basis-1/2 lg:basis-1/3">
|
||||
<div class="p-1">
|
||||
<Card>
|
||||
<CardContent class="flex aspect-square items-center justify-center p-6">
|
||||
<span class="text-2xl font-semibold">{{ index + 1 }}</span>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
</CarouselItem>
|
||||
</CarouselContent>
|
||||
<CarouselPrevious />
|
||||
<CarouselNext />
|
||||
</Carousel>
|
||||
</div>
|
||||
<Carousel
|
||||
class="relative w-full max-w-sm"
|
||||
:opts="{
|
||||
align: 'start',
|
||||
}"
|
||||
>
|
||||
<CarouselContent class="-ml-1">
|
||||
<CarouselItem v-for="(_, index) in 5" :key="index" class="pl-1 md:basis-1/2 lg:basis-1/3">
|
||||
<div class="p-1">
|
||||
<Card>
|
||||
<CardContent class="flex aspect-square items-center justify-center p-6">
|
||||
<span class="text-2xl font-semibold">{{ index + 1 }}</span>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
</CarouselItem>
|
||||
</CarouselContent>
|
||||
<CarouselPrevious />
|
||||
<CarouselNext />
|
||||
</Carousel>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -27,8 +27,8 @@ watchOnce(api, (api) => {
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<div class="flex flex-col items-center space-x-2">
|
||||
<Carousel class="w-full max-w-xs" @init-api="setApi">
|
||||
<div class="w-full sm:w-auto">
|
||||
<Carousel class="relative w-full max-w-xs" @init-api="setApi">
|
||||
<CarouselContent>
|
||||
<CarouselItem v-for="(_, index) in 5" :key="index">
|
||||
<div class="p-1">
|
||||
|
|
|
|||
|
|
@ -4,21 +4,19 @@ import { Card, CardContent } from '@/lib/registry/new-york/ui/card'
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<div class="flex items-center space-x-2">
|
||||
<Carousel class="w-full max-w-xs">
|
||||
<CarouselContent>
|
||||
<CarouselItem v-for="(_, index) in 5" :key="index">
|
||||
<div class="p-1">
|
||||
<Card>
|
||||
<CardContent class="flex aspect-square items-center justify-center p-6">
|
||||
<span class="text-4xl font-semibold">{{ index + 1 }}</span>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
</CarouselItem>
|
||||
</CarouselContent>
|
||||
<CarouselPrevious />
|
||||
<CarouselNext />
|
||||
</Carousel>
|
||||
</div>
|
||||
<Carousel class="relative w-full max-w-xs">
|
||||
<CarouselContent>
|
||||
<CarouselItem v-for="(_, index) in 5" :key="index">
|
||||
<div class="p-1">
|
||||
<Card>
|
||||
<CardContent class="flex aspect-square items-center justify-center p-6">
|
||||
<span class="text-4xl font-semibold">{{ index + 1 }}</span>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
</CarouselItem>
|
||||
</CarouselContent>
|
||||
<CarouselPrevious />
|
||||
<CarouselNext />
|
||||
</Carousel>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -4,27 +4,25 @@ import { Card, CardContent } from '@/lib/registry/new-york/ui/card'
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<div class="w-1/2">
|
||||
<Carousel
|
||||
orientation="vertical"
|
||||
class="w-full max-w-xs"
|
||||
:opts="{
|
||||
align: 'start',
|
||||
}"
|
||||
>
|
||||
<CarouselContent class="-mt-1 h-[200px]">
|
||||
<CarouselItem v-for="(_, index) in 5" :key="index" class="p-1 md:basis-1/2">
|
||||
<div class="p-1">
|
||||
<Card>
|
||||
<CardContent class="flex items-center justify-center p-6">
|
||||
<span class="text-3xl font-semibold">{{ index + 1 }}</span>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
</CarouselItem>
|
||||
</CarouselContent>
|
||||
<CarouselPrevious />
|
||||
<CarouselNext />
|
||||
</Carousel>
|
||||
</div>
|
||||
<Carousel
|
||||
orientation="vertical"
|
||||
class="relative w-full max-w-xs"
|
||||
:opts="{
|
||||
align: 'start',
|
||||
}"
|
||||
>
|
||||
<CarouselContent class="-mt-1 h-[200px]">
|
||||
<CarouselItem v-for="(_, index) in 5" :key="index" class="p-1 md:basis-1/2">
|
||||
<div class="p-1">
|
||||
<Card>
|
||||
<CardContent class="flex items-center justify-center p-6">
|
||||
<span class="text-3xl font-semibold">{{ index + 1 }}</span>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
</CarouselItem>
|
||||
</CarouselContent>
|
||||
<CarouselPrevious />
|
||||
<CarouselNext />
|
||||
</Carousel>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -11,26 +11,24 @@ const plugin = Autoplay({
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<div class="flex items-center space-x-2">
|
||||
<Carousel
|
||||
class="w-full max-w-xs"
|
||||
:plugins="[plugin]"
|
||||
@mouseenter="plugin.stop"
|
||||
@mouseleave="[plugin.reset(), plugin.play(), console.log('Runing')];"
|
||||
>
|
||||
<CarouselContent>
|
||||
<CarouselItem v-for="(_, index) in 5" :key="index">
|
||||
<div class="p-1">
|
||||
<Card>
|
||||
<CardContent class="flex aspect-square items-center justify-center p-6">
|
||||
<span class="text-4xl font-semibold">{{ index + 1 }}</span>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
</CarouselItem>
|
||||
</CarouselContent>
|
||||
<CarouselPrevious />
|
||||
<CarouselNext />
|
||||
</Carousel>
|
||||
</div>
|
||||
<Carousel
|
||||
class="relative w-full max-w-xs"
|
||||
:plugins="[plugin]"
|
||||
@mouseenter="plugin.stop"
|
||||
@mouseleave="[plugin.reset(), plugin.play(), console.log('Runing')];"
|
||||
>
|
||||
<CarouselContent>
|
||||
<CarouselItem v-for="(_, index) in 5" :key="index">
|
||||
<div class="p-1">
|
||||
<Card>
|
||||
<CardContent class="flex aspect-square items-center justify-center p-6">
|
||||
<span class="text-4xl font-semibold">{{ index + 1 }}</span>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
</CarouselItem>
|
||||
</CarouselContent>
|
||||
<CarouselPrevious />
|
||||
<CarouselNext />
|
||||
</Carousel>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -4,26 +4,24 @@ import { Card, CardContent } from '@/lib/registry/new-york/ui/card'
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<div class="flex items-center space-x-2">
|
||||
<Carousel
|
||||
class="w-full max-w-xs"
|
||||
:opts="{
|
||||
align: 'start',
|
||||
}"
|
||||
>
|
||||
<CarouselContent>
|
||||
<CarouselItem v-for="(_, index) in 5" :key="index" class="md:basis-1/2 lg:basis-1/3">
|
||||
<div class="p-1">
|
||||
<Card>
|
||||
<CardContent class="flex aspect-square items-center justify-center p-6">
|
||||
<span class="text-3xl font-semibold">{{ index + 1 }}</span>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
</CarouselItem>
|
||||
</CarouselContent>
|
||||
<CarouselPrevious />
|
||||
<CarouselNext />
|
||||
</Carousel>
|
||||
</div>
|
||||
<Carousel
|
||||
class="relative w-full max-w-xs"
|
||||
:opts="{
|
||||
align: 'start',
|
||||
}"
|
||||
>
|
||||
<CarouselContent>
|
||||
<CarouselItem v-for="(_, index) in 5" :key="index" class="md:basis-1/2 lg:basis-1/3">
|
||||
<div class="p-1">
|
||||
<Card>
|
||||
<CardContent class="flex aspect-square items-center justify-center p-6">
|
||||
<span class="text-3xl font-semibold">{{ index + 1 }}</span>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
</CarouselItem>
|
||||
</CarouselContent>
|
||||
<CarouselPrevious />
|
||||
<CarouselNext />
|
||||
</Carousel>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -4,26 +4,24 @@ import { Card, CardContent } from '@/lib/registry/new-york/ui/card'
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<div class="flex items-center space-x-2">
|
||||
<Carousel
|
||||
class="w-full max-w-sm"
|
||||
:opts="{
|
||||
align: 'start',
|
||||
}"
|
||||
>
|
||||
<CarouselContent class="-ml-1">
|
||||
<CarouselItem v-for="(_, index) in 5" :key="index" class="pl-1 md:basis-1/2 lg:basis-1/3">
|
||||
<div class="p-1">
|
||||
<Card>
|
||||
<CardContent class="flex aspect-square items-center justify-center p-6">
|
||||
<span class="text-2xl font-semibold">{{ index + 1 }}</span>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
</CarouselItem>
|
||||
</CarouselContent>
|
||||
<CarouselPrevious />
|
||||
<CarouselNext />
|
||||
</Carousel>
|
||||
</div>
|
||||
<Carousel
|
||||
class="w-full max-w-sm"
|
||||
:opts="{
|
||||
align: 'start',
|
||||
}"
|
||||
>
|
||||
<CarouselContent class="-ml-1">
|
||||
<CarouselItem v-for="(_, index) in 5" :key="index" class="pl-1 md:basis-1/2 lg:basis-1/3">
|
||||
<div class="p-1">
|
||||
<Card>
|
||||
<CardContent class="flex aspect-square items-center justify-center p-6">
|
||||
<span class="text-2xl font-semibold">{{ index + 1 }}</span>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
</CarouselItem>
|
||||
</CarouselContent>
|
||||
<CarouselPrevious />
|
||||
<CarouselNext />
|
||||
</Carousel>
|
||||
</template>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user