docs: fix carousel page responsive issues and ordering docs as shadcn-ui

This commit is contained in:
Sadegh Barati 2024-01-15 18:48:45 +03:30
parent 7dfab6a6e2
commit a19085dc9b
14 changed files with 209 additions and 230 deletions

View File

@ -52,7 +52,7 @@ const { style } = useConfigStore()
</div> </div>
</div> </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-center': align === 'center',
'items-start': align === 'start', 'items-start': align === 'start',
'items-end': align === 'end', 'items-end': align === 'end',

View File

@ -48,18 +48,6 @@ import {
## Examples ## Examples
### Orientation
Use the `orientation` prop to set the orientation of the carousel.
<ComponentPreview name="CarouselOrientation" />
```vue
<Carousel orientation="vertical | horizontal">
...
</Carousel>
```
### Sizes ### Sizes
To set the size of the items, you can use the `basis` utility class on the `<CarouselItem />`. To set the size of the items, you can use the `basis` utility class on the `<CarouselItem />`.
@ -151,6 +139,17 @@ Responsive
</template> </template>
``` ```
### Orientation
Use the `orientation` prop to set the orientation of the carousel.
<ComponentPreview name="CarouselOrientation" />
```vue
<Carousel orientation="vertical | horizontal">
...
</Carousel>
```
## Options ## Options

View File

@ -27,8 +27,8 @@ watchOnce(api, (api) => {
</script> </script>
<template> <template>
<div class="flex flex-col items-center space-x-2"> <div class="w-full sm:w-auto">
<Carousel class="w-full max-w-xs" @init-api="setApi"> <Carousel class="relative w-full max-w-xs" @init-api="setApi">
<CarouselContent> <CarouselContent>
<CarouselItem v-for="(_, index) in 5" :key="index"> <CarouselItem v-for="(_, index) in 5" :key="index">
<div class="p-1"> <div class="p-1">

View File

@ -4,8 +4,7 @@ import { Card, CardContent } from '@/lib/registry/default/ui/card'
</script> </script>
<template> <template>
<div class="flex items-center space-x-2"> <Carousel class="relative w-full max-w-xs">
<Carousel class="w-full max-w-xs">
<CarouselContent> <CarouselContent>
<CarouselItem v-for="(_, index) in 5" :key="index"> <CarouselItem v-for="(_, index) in 5" :key="index">
<div class="p-1"> <div class="p-1">
@ -20,5 +19,4 @@ import { Card, CardContent } from '@/lib/registry/default/ui/card'
<CarouselPrevious /> <CarouselPrevious />
<CarouselNext /> <CarouselNext />
</Carousel> </Carousel>
</div>
</template> </template>

View File

@ -4,10 +4,9 @@ import { Card, CardContent } from '@/lib/registry/default/ui/card'
</script> </script>
<template> <template>
<div class="w-1/2">
<Carousel <Carousel
orientation="vertical" orientation="vertical"
class="w-full max-w-xs" class="relative w-full max-w-xsw-full max-w-xs"
:opts="{ :opts="{
align: 'start', align: 'start',
}" }"
@ -26,5 +25,4 @@ import { Card, CardContent } from '@/lib/registry/default/ui/card'
<CarouselPrevious /> <CarouselPrevious />
<CarouselNext /> <CarouselNext />
</Carousel> </Carousel>
</div>
</template> </template>

View File

@ -11,9 +11,8 @@ const plugin = Autoplay({
</script> </script>
<template> <template>
<div class="flex items-center space-x-2">
<Carousel <Carousel
class="w-full max-w-xs" class="relative w-full max-w-xs"
:plugins="[plugin]" :plugins="[plugin]"
@mouseenter="plugin.stop" @mouseenter="plugin.stop"
@mouseleave="[plugin.reset(), plugin.play(), console.log('Runing')];" @mouseleave="[plugin.reset(), plugin.play(), console.log('Runing')];"
@ -32,5 +31,4 @@ const plugin = Autoplay({
<CarouselPrevious /> <CarouselPrevious />
<CarouselNext /> <CarouselNext />
</Carousel> </Carousel>
</div>
</template> </template>

View File

@ -4,9 +4,8 @@ import { Card, CardContent } from '@/lib/registry/default/ui/card'
</script> </script>
<template> <template>
<div class="flex items-center space-x-2">
<Carousel <Carousel
class="w-full max-w-xs" class="relative w-full max-w-sm"
:opts="{ :opts="{
align: 'start', align: 'start',
}" }"
@ -25,5 +24,4 @@ import { Card, CardContent } from '@/lib/registry/default/ui/card'
<CarouselPrevious /> <CarouselPrevious />
<CarouselNext /> <CarouselNext />
</Carousel> </Carousel>
</div>
</template> </template>

View File

@ -4,9 +4,8 @@ import { Card, CardContent } from '@/lib/registry/default/ui/card'
</script> </script>
<template> <template>
<div class="flex items-center space-x-2">
<Carousel <Carousel
class="w-full max-w-sm" class="relative w-full max-w-sm"
:opts="{ :opts="{
align: 'start', align: 'start',
}" }"
@ -25,5 +24,4 @@ import { Card, CardContent } from '@/lib/registry/default/ui/card'
<CarouselPrevious /> <CarouselPrevious />
<CarouselNext /> <CarouselNext />
</Carousel> </Carousel>
</div>
</template> </template>

View File

@ -27,8 +27,8 @@ watchOnce(api, (api) => {
</script> </script>
<template> <template>
<div class="flex flex-col items-center space-x-2"> <div class="w-full sm:w-auto">
<Carousel class="w-full max-w-xs" @init-api="setApi"> <Carousel class="relative w-full max-w-xs" @init-api="setApi">
<CarouselContent> <CarouselContent>
<CarouselItem v-for="(_, index) in 5" :key="index"> <CarouselItem v-for="(_, index) in 5" :key="index">
<div class="p-1"> <div class="p-1">

View File

@ -4,8 +4,7 @@ import { Card, CardContent } from '@/lib/registry/new-york/ui/card'
</script> </script>
<template> <template>
<div class="flex items-center space-x-2"> <Carousel class="relative w-full max-w-xs">
<Carousel class="w-full max-w-xs">
<CarouselContent> <CarouselContent>
<CarouselItem v-for="(_, index) in 5" :key="index"> <CarouselItem v-for="(_, index) in 5" :key="index">
<div class="p-1"> <div class="p-1">
@ -20,5 +19,4 @@ import { Card, CardContent } from '@/lib/registry/new-york/ui/card'
<CarouselPrevious /> <CarouselPrevious />
<CarouselNext /> <CarouselNext />
</Carousel> </Carousel>
</div>
</template> </template>

View File

@ -4,10 +4,9 @@ import { Card, CardContent } from '@/lib/registry/new-york/ui/card'
</script> </script>
<template> <template>
<div class="w-1/2">
<Carousel <Carousel
orientation="vertical" orientation="vertical"
class="w-full max-w-xs" class="relative w-full max-w-xs"
:opts="{ :opts="{
align: 'start', align: 'start',
}" }"
@ -26,5 +25,4 @@ import { Card, CardContent } from '@/lib/registry/new-york/ui/card'
<CarouselPrevious /> <CarouselPrevious />
<CarouselNext /> <CarouselNext />
</Carousel> </Carousel>
</div>
</template> </template>

View File

@ -11,9 +11,8 @@ const plugin = Autoplay({
</script> </script>
<template> <template>
<div class="flex items-center space-x-2">
<Carousel <Carousel
class="w-full max-w-xs" class="relative w-full max-w-xs"
:plugins="[plugin]" :plugins="[plugin]"
@mouseenter="plugin.stop" @mouseenter="plugin.stop"
@mouseleave="[plugin.reset(), plugin.play(), console.log('Runing')];" @mouseleave="[plugin.reset(), plugin.play(), console.log('Runing')];"
@ -32,5 +31,4 @@ const plugin = Autoplay({
<CarouselPrevious /> <CarouselPrevious />
<CarouselNext /> <CarouselNext />
</Carousel> </Carousel>
</div>
</template> </template>

View File

@ -4,9 +4,8 @@ import { Card, CardContent } from '@/lib/registry/new-york/ui/card'
</script> </script>
<template> <template>
<div class="flex items-center space-x-2">
<Carousel <Carousel
class="w-full max-w-xs" class="relative w-full max-w-xs"
:opts="{ :opts="{
align: 'start', align: 'start',
}" }"
@ -25,5 +24,4 @@ import { Card, CardContent } from '@/lib/registry/new-york/ui/card'
<CarouselPrevious /> <CarouselPrevious />
<CarouselNext /> <CarouselNext />
</Carousel> </Carousel>
</div>
</template> </template>

View File

@ -4,7 +4,6 @@ import { Card, CardContent } from '@/lib/registry/new-york/ui/card'
</script> </script>
<template> <template>
<div class="flex items-center space-x-2">
<Carousel <Carousel
class="w-full max-w-sm" class="w-full max-w-sm"
:opts="{ :opts="{
@ -25,5 +24,4 @@ import { Card, CardContent } from '@/lib/registry/new-york/ui/card'
<CarouselPrevious /> <CarouselPrevious />
<CarouselNext /> <CarouselNext />
</Carousel> </Carousel>
</div>
</template> </template>