Skip to content

Commit

Permalink
docs: handle @nuxt/ui-pro components display
Browse files Browse the repository at this point in the history
  • Loading branch information
benjamincanac committed Dec 5, 2024
1 parent 695224f commit 0f8c398
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
4 changes: 3 additions & 1 deletion docs/app/components/content/ComponentProps.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
import { upperFirst, camelCase } from 'scule'
import type { ComponentMeta } from 'vue-component-meta'
import * as theme from '#build/ui'
import * as themePro from '#build/ui-pro'
const props = withDefaults(defineProps<{
ignore?: string[]
pro?: boolean
}>(), {
ignore: () => [
'activeClass',
Expand Down Expand Up @@ -32,7 +34,7 @@ const route = useRoute()
const camelName = camelCase(route.params.slug?.[route.params.slug.length - 1] ?? '')
const name = `U${upperFirst(camelName)}`
const componentTheme = (theme as any)[camelName]
const componentTheme = ((props.pro ? themePro : theme) as any)[camelName]
const meta = await fetchComponentMeta(name as any)
const metaProps: ComputedRef<ComponentMeta['props']> = computed(() => {
Expand Down
9 changes: 7 additions & 2 deletions docs/app/components/content/ComponentTheme.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
import json5 from 'json5'
import { camelCase } from 'scule'
import * as theme from '#build/ui'
import * as themePro from '#build/ui-pro'
const props = defineProps<{
pro?: boolean
}>()
const route = useRoute()
const { framework } = useSharedData()
Expand All @@ -12,7 +17,7 @@ const strippedCompoundVariants = ref(false)
const strippedTheme = computed(() => {
const strippedTheme = {
...(theme as any)[name]
...((props.pro ? themePro : theme) as any)[name]
}
if (strippedTheme?.compoundVariants) {
Expand Down Expand Up @@ -50,7 +55,7 @@ const strippedTheme = computed(() => {
const component = computed(() => {
return {
ui: {
[props.pro ? 'uiPro' : 'ui']: {
[name]: strippedTheme.value
}
}
Expand Down
1 change: 0 additions & 1 deletion docs/nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ export default defineNuxtConfig({
'@nuxt/content',
'@nuxt/icon',
'@nuxt/image',
'@nuxt/ui-pro',
'@nuxtjs/color-mode',
'@nuxtjs/mdc',
'@nuxtjs/plausible',
Expand Down

0 comments on commit 0f8c398

Please sign in to comment.