init
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
<script setup lang="ts">
|
||||
import { Primitive, type AsTag } from 'reka-ui'
|
||||
import { badgeVariants, type BadgeVariants } from './badgeVariants'
|
||||
import { cn } from '@/lib/utils'
|
||||
|
||||
defineOptions({ inheritAttrs: false })
|
||||
|
||||
withDefaults(
|
||||
defineProps<{
|
||||
as?: AsTag
|
||||
variant?: BadgeVariants['variant']
|
||||
}>(),
|
||||
{
|
||||
as: 'span',
|
||||
variant: 'default',
|
||||
},
|
||||
)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Primitive :as="as" :class="cn(badgeVariants({ variant }), $attrs.class ?? '')" v-bind="$attrs">
|
||||
<slot />
|
||||
</Primitive>
|
||||
</template>
|
||||
@@ -0,0 +1,20 @@
|
||||
import { cva, type VariantProps } from 'class-variance-authority'
|
||||
|
||||
export const badgeVariants = cva(
|
||||
'inline-flex h-[18px] items-center rounded-none border px-[7px] text-[10px] font-normal leading-none',
|
||||
{
|
||||
variants: {
|
||||
variant: {
|
||||
default: 'border-border bg-primary text-primary-foreground',
|
||||
secondary: 'border-border bg-secondary text-secondary-foreground',
|
||||
outline: 'border-border bg-transparent text-foreground',
|
||||
destructive: 'border-destructive bg-destructive text-destructive-foreground',
|
||||
},
|
||||
},
|
||||
defaultVariants: {
|
||||
variant: 'default',
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
export type BadgeVariants = VariantProps<typeof badgeVariants>
|
||||
@@ -0,0 +1,2 @@
|
||||
export { default as UiBadge } from './UiBadge.vue'
|
||||
export { badgeVariants, type BadgeVariants } from './badgeVariants'
|
||||
Reference in New Issue
Block a user