Switching ui lib & refactoring (#80)
switch to shadcn ui bump runtime versions (node, pnpm, etc) refactor gui
This commit is contained in:
committed by
GitHub
parent
12365282a3
commit
353ec976d5
40
src/lib/components/ui/carousel/carousel-previous.svelte
Normal file
40
src/lib/components/ui/carousel/carousel-previous.svelte
Normal file
@@ -0,0 +1,40 @@
|
||||
<script lang="ts">
|
||||
import {
|
||||
Button,
|
||||
type Props,
|
||||
buttonVariants
|
||||
} from '$lib/components/ui/button/index.js'
|
||||
import { cn } from '$lib/utils.js'
|
||||
import { ArrowLeft } from 'lucide-svelte'
|
||||
import type { VariantProps } from 'tailwind-variants'
|
||||
import { getEmblaContext } from './context.js'
|
||||
|
||||
type $$Props = Props
|
||||
|
||||
let className: $$Props['class'] = undefined
|
||||
export { className as class }
|
||||
export let variant: VariantProps<typeof buttonVariants>['variant'] = 'outline'
|
||||
export let size: VariantProps<typeof buttonVariants>['size'] = 'icon'
|
||||
|
||||
const { orientation, canScrollPrev, scrollPrev, handleKeyDown } =
|
||||
getEmblaContext('<Carousel.Previous/>')
|
||||
</script>
|
||||
|
||||
<Button
|
||||
{variant}
|
||||
{size}
|
||||
class={cn(
|
||||
'absolute h-8 w-8 rounded-full',
|
||||
$orientation === 'horizontal'
|
||||
? '-left-12 top-1/2 -translate-y-1/2'
|
||||
: '-top-12 left-1/2 -translate-x-1/2 rotate-90',
|
||||
className
|
||||
)}
|
||||
disabled={!$canScrollPrev}
|
||||
on:click={scrollPrev}
|
||||
on:keydown={handleKeyDown}
|
||||
{...$$restProps}
|
||||
>
|
||||
<ArrowLeft class="h-4 w-4" />
|
||||
<span class="sr-only">Previous slide</span>
|
||||
</Button>
|
||||
Reference in New Issue
Block a user