Skip to content

Commit 5496651

Browse files
committed
docs(getting-started): improve categories
1 parent 1806eea commit 5496651

File tree

17 files changed

+93
-52
lines changed

17 files changed

+93
-52
lines changed

docs/app/layouts/docs.vue

Lines changed: 62 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -6,64 +6,83 @@ const route = useRoute()
66
77
const navigation = inject<Ref<ContentNavigationItem[]>>('navigation')
88
9-
const categories = [{
10-
id: 'layout',
11-
title: 'Layout'
12-
}, {
13-
id: 'element',
14-
title: 'Element'
15-
}, {
16-
id: 'form',
17-
title: 'Form'
18-
}, {
19-
id: 'data',
20-
title: 'Data'
21-
}, {
22-
id: 'navigation',
23-
title: 'Navigation'
24-
}, {
25-
id: 'overlay',
26-
title: 'Overlay'
27-
}, {
28-
id: 'page',
29-
title: 'Page'
30-
}, {
31-
id: 'content',
32-
title: 'Content'
33-
}, {
34-
id: 'dashboard',
35-
title: 'Dashboard'
36-
}, {
37-
id: 'chat',
38-
title: 'AI Chat'
39-
}, {
40-
id: 'color-mode',
41-
title: 'Color Mode'
42-
}, {
43-
id: 'i18n',
44-
title: 'i18n'
45-
}]
9+
const categories = {
10+
'getting-started': [{
11+
id: 'integrations',
12+
title: 'Integrations'
13+
}],
14+
'components': [{
15+
id: 'layout',
16+
title: 'Layout'
17+
}, {
18+
id: 'element',
19+
title: 'Element'
20+
}, {
21+
id: 'form',
22+
title: 'Form'
23+
}, {
24+
id: 'data',
25+
title: 'Data'
26+
}, {
27+
id: 'navigation',
28+
title: 'Navigation'
29+
}, {
30+
id: 'overlay',
31+
title: 'Overlay'
32+
}, {
33+
id: 'page',
34+
title: 'Page'
35+
}, {
36+
id: 'content',
37+
title: 'Content'
38+
}, {
39+
id: 'dashboard',
40+
title: 'Dashboard'
41+
}, {
42+
id: 'chat',
43+
title: 'AI Chat'
44+
}, {
45+
id: 'color-mode',
46+
title: 'Color Mode'
47+
}, {
48+
id: 'i18n',
49+
title: 'i18n'
50+
}]
51+
}
4652
47-
function groupChildrenByCategory(items: ContentNavigationItem[]): ContentNavigationItem[] {
53+
function groupChildrenByCategory(items: ContentNavigationItem[], slug: string): ContentNavigationItem[] {
4854
const childrenGroupedByCategory = items.reduce((acc, child) => {
4955
if (child.category) {
5056
acc[child.category as string] = [...(acc[child.category as string] || []), child]
57+
} else {
58+
acc.__overview = [...(acc.__overview || []), child]
5159
}
5260
return acc
5361
}, {} as Record<string, ContentNavigationItem[]>)
5462
55-
return categories.map(category => ({
63+
const grouped = categories[slug as keyof typeof categories]?.map(category => ({
5664
...category,
57-
path: `/docs/components`,
65+
path: `/docs/${slug}`,
5866
children: childrenGroupedByCategory[category.id]
59-
}))
67+
}))?.filter(category => category.children?.length) || []
68+
69+
if (childrenGroupedByCategory.__overview && childrenGroupedByCategory.__overview.length > 0) {
70+
grouped.unshift({
71+
id: 'overview',
72+
title: 'Overview',
73+
path: `/docs/${slug}`,
74+
children: childrenGroupedByCategory.__overview
75+
})
76+
}
77+
78+
return grouped
6079
}
6180
6281
const children = computed(() => {
63-
const slug = route.params.slug?.[0]
82+
const slug = route.params.slug?.[0] as string
6483
const children = findPageChildren(navigation?.value, `/docs/${slug}`, { indexAsChild: true })?.map(child => ({ ...child, icon: undefined }))
6584
66-
return slug === 'components' ? groupChildrenByCategory(children) : [{ title: 'Overview', path: `/docs/${slug}`, children }]
85+
return groupChildrenByCategory(children, slug)
6786
})
6887
</script>
6988

docs/app/pages/docs/[...slug].vue

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,6 @@ const communityLinks = computed(() => [{
8888
label: 'Star on GitHub',
8989
to: `https://github.com/nuxt/ui`,
9090
target: '_blank'
91-
}, {
92-
icon: 'i-lucide-git-pull-request-arrow',
93-
label: 'Contribution',
94-
to: '/docs/getting-started/contribution'
9591
}])
9692
</script>
9793

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
icon: 'i-lucide-arrow-right-left'
2+
shadow: true
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
title: Migration to v4
3+
description: 'A comprehensive guide to migrate your application from Nuxt UI v3 to Nuxt UI v4.'
4+
navigation.title: 'Migration'
5+
navigation.icon: 'i-lucide-arrow-right-left'
6+
links:
7+
- label: 'Migration to v3'
8+
to: '/docs/getting-started/migration/v3'
9+
icon: 'i-lucide-arrow-right-left'
10+
---
11+
12+
## Migrate your project

docs/content/docs/1.getting-started/2.migration.md renamed to docs/content/docs/1.getting-started/3.migration/2.v3.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
---
2-
title: Migration
2+
title: Migration to v3
33
description: 'A comprehensive guide to migrate your application from Nuxt UI v2 to Nuxt UI v3.'
4-
navigation.icon: 'i-lucide-arrow-right-left'
4+
links:
5+
- label: 'Migration to v4'
6+
to: '/docs/getting-started/migration/v4'
7+
icon: 'i-lucide-arrow-right-left'
8+
navigation: false
59
---
610

711
Nuxt UI v3.0 is a new major version rebuilt from the ground up, introducing a modern architecture with significant performance improvements and an enhanced developer experience. This major release includes several breaking changes alongside powerful new features and capabilities:

docs/content/docs/1.getting-started/contribution.md renamed to docs/content/docs/1.getting-started/4.contribution.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
2-
title: Contribution Guide
2+
title: Contribution
33
description: 'A comprehensive guide on contributing to Nuxt UI, including project structure, development workflow, and best practices.'
4-
navigation: false
4+
navigation.icon: 'i-lucide-handshake'
55
---
66

77
Nuxt UI thrives thanks to its incredible community ❤️. We welcome all contributions through bug reports, pull requests, and feedback to help make this library even better.

docs/content/docs/1.getting-started/4.icons/1.nuxt.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
title: Icons
33
description: 'Nuxt UI integrates with Nuxt Icon to access over 200,000+ icons from Iconify.'
44
framework: nuxt
5+
category: integrations
56
links:
67
- label: 'Iconify'
78
to: https://iconify.design/

docs/content/docs/1.getting-started/4.icons/2.vue.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
title: Icons
33
description: 'Nuxt UI integrates with Iconify to access over 200,000+ icons.'
44
framework: vue
5+
category: integrations
56
links:
67
- label: 'Iconify'
78
to: https://iconify.design/

docs/content/docs/1.getting-started/5.fonts.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
title: Fonts
33
description: 'Nuxt UI integrates with Nuxt Fonts to provide plug-and-play font optimization.'
44
framework: nuxt
5+
category: integrations
56
links:
67
- label: 'nuxt/fonts'
78
to: https://github.com/nuxt/fonts

docs/content/docs/1.getting-started/3.theme.md renamed to docs/content/docs/1.getting-started/5.theme.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
title: Theme
33
description: 'Learn how to customize Nuxt UI components using Tailwind CSS v4, CSS variables and the Tailwind Variants API for powerful and flexible theming.'
44
navigation.icon: i-lucide-swatch-book
5-
navigation.path: /docs/getting-started/theme
65
---
76

87
## Tailwind CSS

0 commit comments

Comments
 (0)