From 18311d32d84c508c6b3b5597008d7efbb5a85c35 Mon Sep 17 00:00:00 2001 From: Benjamin Canac Date: Mon, 1 Jul 2024 17:26:03 +0200 Subject: [PATCH] docs: improve props --- .../app/components/content/ComponentProps.vue | 2 ++ .../content/ComponentPropsSchema.vue | 31 +++++++++++++++++++ .../content/HighlightInlineType.vue | 13 +++++++- 3 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 docs/app/components/content/ComponentPropsSchema.vue diff --git a/docs/app/components/content/ComponentProps.vue b/docs/app/components/content/ComponentProps.vue index f2801d05..d6e124d1 100644 --- a/docs/app/components/content/ComponentProps.vue +++ b/docs/app/components/content/ComponentProps.vue @@ -52,6 +52,8 @@ const metaProps: ComputedRef = computed(() => { + + diff --git a/docs/app/components/content/ComponentPropsSchema.vue b/docs/app/components/content/ComponentPropsSchema.vue new file mode 100644 index 00000000..b33e5c96 --- /dev/null +++ b/docs/app/components/content/ComponentPropsSchema.vue @@ -0,0 +1,31 @@ + + + diff --git a/docs/app/components/content/HighlightInlineType.vue b/docs/app/components/content/HighlightInlineType.vue index 817800a0..0d259010 100644 --- a/docs/app/components/content/HighlightInlineType.vue +++ b/docs/app/components/content/HighlightInlineType.vue @@ -5,7 +5,18 @@ const props = defineProps<{ type: string }>() -const { data: ast } = await useAsyncData(`hightlight-inline-code-` + props.type, () => parseMarkdown(`\`${props.type}\`{lang="ts-type"}`)) +const type = computed(() => { + if (props.type.includes(', "as" | "asChild" | "forceMount">')) { + return props.type.replace(`, "as" | "asChild" | "forceMount">`, ``).replace('Omit<', '') + } + if (props.type.includes(', "as" | "asChild">')) { + return props.type.replace(', "as" | "asChild">', '').replace('Omit<', '') + } + + return props.type +}) + +const { data: ast } = await useAsyncData(`hightlight-inline-code-` + props.type, () => parseMarkdown(`\`${type.value}\`{lang="ts-type"}`))