shadcn-vue/packages/module/playground/components/ui/carousel/CarouselNext.vue
zernonia 7a7cf9d05d
fix: Nuxt module throwing error due to parsing error (#267)
* chore: add carousel

* chore: add oxc-parser

* feat: use oxc-parser to get ExportNamedDeclaration node

* chore: add todo
2024-01-12 10:18:30 +08:00

31 lines
803 B
Vue

<script setup lang="ts">
import { ChevronRight } from 'lucide-vue-next'
import { useCarousel } from './useCarousel'
import type { WithClassAsProps } from './interface'
import { cn } from '@/lib/utils'
import { Button } from '@/components/ui/button'
const props = defineProps<WithClassAsProps>()
const { orientation, canScrollNext, scrollNext } = useCarousel()
</script>
<template>
<Button
:disabled="!canScrollNext"
:class="cn(
'absolute h-10 w-10 rounded-full p-0',
orientation === 'horizontal'
? '-right-12 top-1/2 -translate-y-1/2'
: '-bottom-12 left-1/2 -translate-x-1/2 rotate-90',
props.class,
)"
variant="outline"
@click="scrollNext"
>
<slot>
<ChevronRight class="h-4 w-4 text-current" />
</slot>
</Button>
</template>