Init
This commit is contained in:
28
app/components/ui/button/Button.vue
Normal file
28
app/components/ui/button/Button.vue
Normal file
@@ -0,0 +1,28 @@
|
||||
<script setup lang="ts">
|
||||
import type { PrimitiveProps } from 'reka-ui'
|
||||
import type { HTMLAttributes } from 'vue'
|
||||
import type { ButtonVariants } from '.'
|
||||
import { Primitive } from 'reka-ui'
|
||||
import { cn } from '~/lib/utils'
|
||||
import { buttonVariants } from '.'
|
||||
|
||||
interface Props extends PrimitiveProps {
|
||||
variant?: ButtonVariants['variant']
|
||||
size?: ButtonVariants['size']
|
||||
class?: HTMLAttributes['class']
|
||||
}
|
||||
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
as: 'button',
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Primitive
|
||||
:as="as"
|
||||
:as-child="asChild"
|
||||
:class="cn(buttonVariants({ variant, size }), props.class)"
|
||||
>
|
||||
<slot />
|
||||
</Primitive>
|
||||
</template>
|
||||
36
app/components/ui/button/index.ts
Normal file
36
app/components/ui/button/index.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
import type { VariantProps } from 'class-variance-authority'
|
||||
import { cva } from 'class-variance-authority'
|
||||
|
||||
export { default as Button } from './Button.vue'
|
||||
|
||||
export const buttonVariants = cva(
|
||||
'inline-flex items-center justify-center gap-2 whitespace-nowrap text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0',
|
||||
{
|
||||
variants: {
|
||||
variant: {
|
||||
default: 'btn-experimenta',
|
||||
destructive: 'bg-destructive text-destructive-foreground hover:bg-destructive/90 rounded-md',
|
||||
outline: 'border border-input bg-background hover:bg-accent hover:text-accent-foreground rounded-md',
|
||||
secondary: 'bg-secondary text-secondary-foreground hover:bg-secondary/80 rounded-md',
|
||||
ghost: 'hover:bg-accent hover:text-accent-foreground rounded-md',
|
||||
link: 'text-primary underline-offset-4 hover:underline',
|
||||
experimenta: 'btn-experimenta',
|
||||
},
|
||||
size: {
|
||||
default: 'px-[30px] py-[10px] text-lg leading-[1.7em]',
|
||||
sm: 'h-9 rounded-md px-3',
|
||||
lg: 'h-11 rounded-md px-8',
|
||||
icon: 'h-10 w-10',
|
||||
'icon-sm': 'size-9',
|
||||
'icon-lg': 'size-11',
|
||||
experimenta: 'px-[30px] py-[10px] text-lg leading-[1.7em]',
|
||||
},
|
||||
},
|
||||
defaultVariants: {
|
||||
variant: 'default',
|
||||
size: 'default',
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
export type ButtonVariants = VariantProps<typeof buttonVariants>
|
||||
Reference in New Issue
Block a user