mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-25 01:10:40 +01:00
chore(components): improve props
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { tv } from 'tailwind-variants'
|
||||
import type { PrimitiveProps } from 'radix-vue'
|
||||
import type { AppConfig } from '@nuxt/schema'
|
||||
import _appConfig from '#build/app.config'
|
||||
import theme from '#build/ui/card'
|
||||
@@ -9,7 +8,12 @@ const appConfig = _appConfig as AppConfig & { ui: { card: Partial<typeof theme>
|
||||
|
||||
const card = tv({ extend: tv(theme), ...(appConfig.ui?.card || {}) })
|
||||
|
||||
export interface CardProps extends Omit<PrimitiveProps, 'asChild'> {
|
||||
export interface CardProps {
|
||||
/**
|
||||
* The element or component this component should render as.
|
||||
* @defaultValue 'div'
|
||||
*/
|
||||
as?: any
|
||||
class?: any
|
||||
ui?: Partial<typeof card.slots>
|
||||
}
|
||||
@@ -25,7 +29,7 @@ export interface CardSlots {
|
||||
import { computed } from 'vue'
|
||||
import { Primitive } from 'radix-vue'
|
||||
|
||||
const props = withDefaults(defineProps<CardProps>(), { as: 'div' })
|
||||
const props = defineProps<CardProps>()
|
||||
const slots = defineSlots<CardSlots>()
|
||||
|
||||
const ui = computed(() => tv({ extend: card, slots: props.ui })())
|
||||
|
||||
Reference in New Issue
Block a user