Skip to content

Commit

Permalink
docs(ComponentTheme): broken github link (#3223)
Browse files Browse the repository at this point in the history
  • Loading branch information
HugoRCD authored Feb 2, 2025
1 parent 69bc686 commit f21e923
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions docs/app/components/content/ComponentTheme.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,16 @@ const props = defineProps<{
const route = useRoute()
const { framework } = useSharedData()
const name = camelCase(props.slug ?? route.params.slug?.[route.params.slug.length - 1] ?? '')
const name = props.slug ?? route.params.slug?.[route.params.slug.length - 1] ?? ''
const camelName = camelCase(name)
const strippedCompoundVariants = ref(false)
const computedTheme = computed(() => props.pro ? props.prose ? themePro.prose : themePro : theme)
const strippedTheme = computed(() => {
const strippedTheme = {
...(computedTheme.value as any)[name]
...(computedTheme.value as any)[camelName]
}
if (strippedTheme?.compoundVariants) {
Expand Down Expand Up @@ -63,8 +64,8 @@ const component = computed(() => {
const baseKey = props.pro ? 'uiPro' : 'ui'
const content = props.prose
? { prose: { [name]: strippedTheme.value } }
: { [name]: strippedTheme.value }
? { prose: { [camelName]: strippedTheme.value } }
: { [camelName]: strippedTheme.value }
if (props.extra?.length) {
props.extra.forEach((extra) => {
Expand All @@ -78,7 +79,14 @@ const component = computed(() => {
}
})
const { data: ast } = await useAsyncData(`component-theme-${name}-${hash({ props })}`, async () => {
const themeLink = computed(() => {
const repo = props.pro ? 'ui-pro' : 'ui'
const slug = name.startsWith('content') ? `content/${name}` : name
return `https://github.com/nuxt/${repo}/blob/v3/src/theme/${slug}.ts`
})
const { data: ast } = await useAsyncData(`component-theme-${camelName}-${hash({ props })}`, async () => {
const md = `
::code-collapse{class="nuxt-only"}
Expand Down Expand Up @@ -110,7 +118,7 @@ export default defineConfig({
${strippedCompoundVariants.value
? `
::callout{icon="i-simple-icons-github" to="https://github.com/nuxt/ui/blob/v3/src/theme/${name}.ts"}
::callout{icon="i-simple-icons-github" to="${themeLink.value}" title="Compound variants"}
Some colors in \`compoundVariants\` are omitted for readability. Check out the source code on GitHub.
::`
: ''}
Expand Down

0 comments on commit f21e923

Please sign in to comment.