mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-14 20:19:34 +01:00
docs(ComponentProps): improve display
This commit is contained in:
@@ -24,6 +24,8 @@ const metaProps: ComputedRef<ComponentMeta['props']> = computed(() => {
|
||||
return !props.ignore?.includes(prop.name)
|
||||
}).map((prop) => {
|
||||
prop.default = prop.default ?? prop.tags?.find(tag => tag.name === 'defaultValue')?.text ?? componentTheme?.defaultVariants?.[prop.name]
|
||||
// @ts-expect-error - Type is not correct
|
||||
prop.type = !['boolean'].includes(prop.type) && prop.schema?.kind === 'enum' && Object.keys(prop.schema.schema)?.length ? Object.values(prop.schema.schema).map(schema => schema?.type ? schema.type : schema).join(' | ') : prop.type
|
||||
return prop
|
||||
}).sort((a, b) => {
|
||||
if (a.name === 'as') {
|
||||
|
||||
@@ -25,9 +25,8 @@ const schemaProps = computed(() => getSchemaProps(props.prop.schema))
|
||||
<ProseUl>
|
||||
<ProseLi v-for="schemaProp in schemaProps" :key="schemaProp.name">
|
||||
<HighlightInlineType :type="`${schemaProp.name}${schemaProp.required === false ? '?' : ''}: ${schemaProp.type}`" />
|
||||
<p v-if="schemaProp.description" class="text-gray-600 dark:text-gray-400">
|
||||
{{ schemaProp.description }}
|
||||
</p>
|
||||
|
||||
<MDC v-if="schemaProp.description" :value="schemaProp.description" class="text-gray-500 dark:text-gray-400 my-1" />
|
||||
</ProseLi>
|
||||
</ProseUl>
|
||||
</Collapsible>
|
||||
|
||||
Reference in New Issue
Block a user