From c712e2e682d17dab7be45d4a5e172817940bc8f4 Mon Sep 17 00:00:00 2001 From: Benjamin Canac Date: Thu, 11 Jul 2024 17:14:27 +0200 Subject: [PATCH] docs(ComponentCode): handle case where theme doesn't exist --- docs/app/components/content/ComponentCode.vue | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/app/components/content/ComponentCode.vue b/docs/app/components/content/ComponentCode.vue index cbcf6dd7..d74853dd 100644 --- a/docs/app/components/content/ComponentCode.vue +++ b/docs/app/components/content/ComponentCode.vue @@ -4,7 +4,9 @@ import { upperFirst, camelCase } from 'scule' import * as theme from '#build/ui' const props = defineProps<{ + /** List of props to ignore */ ignore?: string[] + /** List of items for each prop */ items?: { [key: string]: string[] } props?: { [key: string]: any } slots?: { [key: string]: any } @@ -32,7 +34,7 @@ const options = computed(() => Object.keys(props.props || {}).filter((key) => { })) : prop?.type === 'boolean' ? [{ value: true, label: 'true' }, { value: false, label: 'false' }] - : Object.keys(componentTheme.variants?.[key] || {}).map(variant => ({ + : Object.keys(componentTheme?.variants?.[key] || {}).map(variant => ({ value: variant, label: variant, chip: key === 'color' ? { color: variant } : undefined