Skip to content

Commit

Permalink
docs(ComponentTheme): add extra prop
Browse files Browse the repository at this point in the history
  • Loading branch information
benjamincanac committed Jan 7, 2025
1 parent 698b2c4 commit e4f90e7
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion docs/app/components/content/ComponentTheme.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const props = defineProps<{
pro?: boolean
prose?: boolean
slug?: string
extra?: string[]
}>()
const route = useRoute()
Expand All @@ -17,9 +18,11 @@ const name = camelCase(props.slug ?? route.params.slug?.[route.params.slug.lengt
const strippedCompoundVariants = ref(false)
const computedTheme = computed(() => props.pro ? props.prose ? themePro.prose : themePro : theme)
const strippedTheme = computed(() => {
const strippedTheme = {
...((props.pro ? props.prose ? themePro.prose : themePro : theme) as any)[name]
...(computedTheme.value as any)[name]
}
if (strippedTheme?.compoundVariants) {
Expand Down Expand Up @@ -57,10 +60,18 @@ const strippedTheme = computed(() => {
const component = computed(() => {
const baseKey = props.pro ? 'uiPro' : 'ui'
const content = props.prose
? { prose: { [name]: strippedTheme.value } }
: { [name]: strippedTheme.value }
if (props.extra?.length) {
props.extra.forEach((extra) => {
const target = props.prose ? content.prose! : content
target[extra as keyof typeof target] = computedTheme.value[extra as keyof typeof computedTheme.value]
})
}
return {
[baseKey]: content
}
Expand Down

0 comments on commit e4f90e7

Please sign in to comment.