Skip to content

Commit d50af33

Browse files
committed
chore: clean up sidebar & breadcrumbs
1 parent 2e0575b commit d50af33

File tree

2 files changed

+67
-57
lines changed

2 files changed

+67
-57
lines changed

content/ui/index.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,32 @@ contributors: false
55

66
<script setup lang="ts">
77
import uiSidebar from "./sidebar";
8-
function categoryId(category: any) {
9-
const url = new URL(category.link, 'https://example.com/')
10-
return url.hash.slice(1);
8+
9+
function category(name: string) {
10+
return uiSidebar[0].items.find(i => i.text === 'Layout Containers').items
1111
}
1212
</script>
1313

1414
## Layout Containers {#layout-containers}
1515

1616
<ul>
17-
<li v-for="item in uiSidebar.find(i => i.text === 'Layout Containers').items">
17+
<li v-for="item in category('Layout Containers')">
1818
<a :href="item.link">{{ item.text }}</a>
1919
</li>
2020
</ul>
2121

2222
## Navigation Components {#navigation-components}
2323

2424
<ul>
25-
<li v-for="item in uiSidebar.find(i => i.text === 'Navigation Components').items">
25+
<li v-for="item in category('Navigation Components')">
2626
<a :href="item.link">{{ item.text }}</a>
2727
</li>
2828
</ul>
2929

3030
## Components {#components}
3131

3232
<ul>
33-
<li v-for="item in uiSidebar.find(i => i.text === 'Components').items">
33+
<li v-for="item in category('Components')">
3434
<a :href="item.link">{{ item.text }}</a>
3535
</li>
3636
</ul>

content/ui/sidebar.ts

Lines changed: 61 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,69 @@
1-
import type { NSSidebarGroup } from '../../.vitepress/theme/vitepress-theme'
1+
import type { NSSidebarItem } from '../../.vitepress/theme/vitepress-theme'
22

33
export default [
44
{
5-
text: 'Layout Containers',
6-
link: '/ui/#layout-containers',
5+
text: 'UI Components',
6+
link: '/ui/',
7+
// hides the sidebar item from the sidebar, but keeps it in the breadcrumbs
8+
visible: false,
9+
// todo: add a different type to disable indentation on the root level
10+
type: 'filetree',
711
items: [
8-
{ text: 'StackLayout', link: '/ui/stack-layout' },
9-
{ text: 'GridLayout', link: '/ui/grid-layout' },
10-
{ text: 'RootLayout', link: '/ui/root-layout' },
11-
{ text: 'FlexboxLayout', link: '/ui/flexbox-layout' },
12-
{ text: 'WrapLayout', link: '/ui/wrap-layout' },
13-
{ text: 'DockLayout', link: '/ui/dock-layout' },
14-
{ text: 'AbsoluteLayout', link: '/ui/absolute-layout' },
15-
],
16-
},
17-
{
18-
text: 'Navigation Components',
19-
link: '/ui/#navigation-containers',
20-
items: [
21-
// { text: 'Frame', link: '//#' },
22-
{ text: 'Page', link: '/ui/page' },
23-
{ text: 'ActionBar', link: '/ui/action-bar' },
24-
// { text: 'ActionItem', link: '//#' },
25-
// { text: 'NavigationButton', link: '//#' },
26-
// todo: move this elsewhere
2712
{
28-
text: 'Showing Modal',
29-
link: '/guide/ui/showing-modal',
13+
text: 'Layout Containers',
14+
link: '/ui/#layout-containers',
15+
items: [
16+
{ text: 'StackLayout', link: '/ui/stack-layout' },
17+
{ text: 'GridLayout', link: '/ui/grid-layout' },
18+
{ text: 'RootLayout', link: '/ui/root-layout' },
19+
{ text: 'FlexboxLayout', link: '/ui/flexbox-layout' },
20+
{ text: 'WrapLayout', link: '/ui/wrap-layout' },
21+
{ text: 'DockLayout', link: '/ui/dock-layout' },
22+
{ text: 'AbsoluteLayout', link: '/ui/absolute-layout' },
23+
],
24+
},
25+
{
26+
text: 'Navigation Components',
27+
link: '/ui/#navigation-containers',
28+
items: [
29+
// { text: 'Frame', link: '//#' },
30+
{ text: 'Page', link: '/ui/page' },
31+
{ text: 'ActionBar', link: '/ui/action-bar' },
32+
// { text: 'ActionItem', link: '//#' },
33+
// { text: 'NavigationButton', link: '//#' },
34+
// todo: move this elsewhere
35+
{
36+
text: 'Showing Modal',
37+
link: '/guide/ui/showing-modal',
38+
},
39+
],
40+
},
41+
{
42+
text: 'Components',
43+
link: '/ui/#components',
44+
items: [
45+
{ text: 'ActivityIndicator', link: '/ui/activity-indicator' },
46+
{ text: 'Button', link: '/ui/button' },
47+
{ text: 'DatePicker', link: '/ui/datepicker' },
48+
{ text: 'HtmlView', link: '/ui/htmlview' },
49+
{ text: 'Image', link: '/ui/image' },
50+
{ text: 'Label', link: '/ui/label' },
51+
{ text: 'ListPicker', link: '/ui/listpicker' },
52+
{ text: 'ListView', link: '/ui/listview' },
53+
{ text: 'Placeholder', link: '/ui/placeholder' },
54+
{ text: 'Progress', link: '/ui/progress' },
55+
{ text: 'ScrollView', link: '/ui/scrollview' },
56+
{ text: 'SearchBar', link: '/ui/searchbar' },
57+
{ text: 'SegmentedBar', link: '/ui/segmentedbar' },
58+
{ text: 'Slider', link: '/ui/slider' },
59+
{ text: 'Switch', link: '/ui/switch' },
60+
{ text: 'TabView', link: '/ui/tabview' },
61+
{ text: 'TextField', link: '/ui/textfield' },
62+
{ text: 'TextView', link: '/ui/textview' },
63+
{ text: 'TimePicker', link: '/ui/timepicker' },
64+
{ text: 'WebView', link: '/ui/webview' },
65+
],
3066
},
3167
],
3268
},
33-
{
34-
text: 'Components',
35-
link: '/ui/#components',
36-
items: [
37-
{ text: 'ActivityIndicator', link: '/ui/activity-indicator' },
38-
{ text: 'Button', link: '/ui/button' },
39-
{ text: 'DatePicker', link: '/ui/datepicker' },
40-
{ text: 'HtmlView', link: '/ui/htmlview' },
41-
{ text: 'Image', link: '/ui/image' },
42-
{ text: 'Label', link: '/ui/label' },
43-
{ text: 'ListPicker', link: '/ui/listpicker' },
44-
{ text: 'ListView', link: '/ui/listview' },
45-
{ text: 'Placeholder', link: '/ui/placeholder' },
46-
{ text: 'Progress', link: '/ui/progress' },
47-
{ text: 'ScrollView', link: '/ui/scrollview' },
48-
{ text: 'SearchBar', link: '/ui/searchbar' },
49-
{ text: 'SegmentedBar', link: '/ui/segmentedbar' },
50-
{ text: 'Slider', link: '/ui/slider' },
51-
{ text: 'Switch', link: '/ui/switch' },
52-
{ text: 'TabView', link: '/ui/tabview' },
53-
{ text: 'TextField', link: '/ui/textfield' },
54-
{ text: 'TextView', link: '/ui/textview' },
55-
{ text: 'TimePicker', link: '/ui/timepicker' },
56-
{ text: 'WebView', link: '/ui/webview' },
57-
],
58-
},
59-
] as NSSidebarGroup[]
69+
] as NSSidebarItem[]

0 commit comments

Comments
 (0)