Skip to content

Commit 02259ef

Browse files
committed
docs: Improve document content
1 parent 3f3e417 commit 02259ef

File tree

18 files changed

+404
-290
lines changed

18 files changed

+404
-290
lines changed

README.md

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,24 +34,34 @@ kotlin {
3434

3535
```
3636
@Composable
37-
fun AppWithColors() {
38-
val colors = lightColorScheme()
39-
MiuixTheme(colors = colors) { /* Content */ }
37+
fun AppTheme(
38+
content: @Composable () -> Unit
39+
) {
40+
val colors = if (isSystemInDarkTheme()) darkColorScheme() else lightColorScheme()
41+
return MiuixTheme(
42+
colors = colors,
43+
content = content
44+
)
4045
}
4146
```
4247

4348
- Controller-based: control modes via `ThemeController` and enable Monet dynamic colors; pass `keyColor` to set a custom seed color.
4449

4550
```
4651
@Composable
47-
fun AppWithMonet() {
52+
fun AppTheme(
53+
content: @Composable () -> Unit
54+
) {
4855
val controller = remember {
4956
ThemeController(
5057
ColorSchemeMode.MonetSystem,
5158
keyColor = Color(0xFF3482FF)
5259
)
5360
}
54-
MiuixTheme(controller = controller) { /* Content */ }
61+
return MiuixTheme(
62+
controller = controller,
63+
content = content
64+
)
5565
}
5666
```
5767

docs/.vitepress/config.ts

Lines changed: 39 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
import { defineConfig } from 'vitepress'
2-
import locales from './locales'
3-
import zh_CN from './locales/zh_CN'
1+
import { defineConfig } from "vitepress";
2+
import locales from "./locales";
3+
import {
4+
GitChangelog,
5+
GitChangelogMarkdownSection,
6+
} from "@nolebase/vitepress-plugin-git-changelog/vite";
47

58
export default defineConfig({
6-
base: '/miuix/',
9+
base: "/miuix/",
710
title: "Miuix",
811
locales: locales.locales,
912
head: [
@@ -15,50 +18,64 @@ export default defineConfig({
1518
lazyLoading: true,
1619
},
1720
},
18-
lastUpdated: true,
1921
cleanUrls: true,
2022
themeConfig: {
21-
22-
logo: '/Icon.webp',
23-
23+
logo: "/Icon.webp",
24+
socialLinks: [
25+
{ icon: 'github', link: 'https://github.com/compose-miuix-ui/miuix' }
26+
],
2427
search: {
25-
provider: 'local',
28+
provider: "local",
2629
options: {
2730
locales: {
2831
zh_CN: {
2932
translations: {
3033
button: {
31-
buttonText: '搜索文档',
32-
buttonAriaLabel: '搜索文档'
34+
buttonText: "搜索",
35+
buttonAriaLabel: "搜索",
3336
},
3437
modal: {
35-
noResultsText: '无法找到相关结果',
36-
resetButtonTitle: '清除查询条件',
38+
noResultsText: "无法找到相关结果",
39+
resetButtonTitle: "清除查询条件",
3740
footer: {
38-
selectText: '选择',
39-
navigateText: '切换',
40-
closeText: '关闭',
41+
selectText: "选择",
42+
navigateText: "切换",
43+
closeText: "关闭",
4144
},
4245
},
4346
},
4447
},
4548
},
4649
},
4750
},
51+
docFooter: {
52+
prev: false,
53+
next: false,
54+
},
4855
},
4956
vite: {
5057
optimizeDeps: {
5158
exclude: [
52-
'@nolebase/vitepress-plugin-enhanced-readabilities/client',
53-
'vitepress',
54-
'@nolebase/ui',
59+
"@nolebase/vitepress-plugin-enhanced-readabilities/client",
60+
"vitepress",
61+
"@nolebase/ui",
5562
],
5663
},
5764
ssr: {
5865
noExternal: [
59-
'@nolebase/vitepress-plugin-enhanced-readabilities',
60-
'@nolebase/ui',
66+
"@nolebase/vitepress-plugin-enhanced-readabilities",
67+
"@nolebase/ui",
6168
],
6269
},
70+
plugins: [
71+
GitChangelog({
72+
repoURL: () => "https://github.com/compose-miuix-ui/miuix",
73+
}),
74+
GitChangelogMarkdownSection({
75+
sections: {
76+
disableContributors: true,
77+
},
78+
}),
79+
],
6380
},
64-
})
81+
});

docs/.vitepress/locales/en_US.ts

Lines changed: 65 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -1,113 +1,100 @@
1-
2-
import { defineConfig } from 'vitepress'
1+
import { defineConfig } from "vitepress";
32

43
export default defineConfig({
54
description: "A UI library for Compose MultiPlatform",
6-
lang: 'en_US',
5+
lang: "en_US",
76
themeConfig: {
8-
9-
socialLinks: [
10-
{ icon: 'github', link: 'https://github.com/compose-miuix-ui/miuix' }
11-
],
12-
13-
editLink: {
14-
pattern: 'https://github.com/compose-miuix-ui/miuix/edit/main/docs/:path',
15-
text: 'Edit this page on GitHub'
7+
outline: {
8+
level: [2, 4],
169
},
1710

1811
footer: {
19-
message: 'Released under the Apache-2.0 License',
20-
copyright: `Copyright © 2024-${new Date().getFullYear()} compose-miuix-ui`
12+
message: "Released under the Apache-2.0 License",
13+
copyright: `Copyright © 2024-${new Date().getFullYear()} compose-miuix-ui`,
2114
},
2215

2316
nav: [
24-
{ text: 'Home', link: '/' },
25-
{ text: 'Getting Started', link: '/guide/getting-started' },
26-
{ text: 'Components', link: '/components/' },
17+
{ text: "Home", link: "/" },
18+
{ text: "Getting Started", link: "/guide/getting-started" },
19+
{ text: "Components", link: "/components/" },
2720
],
2821

2922
sidebar: {
30-
'/guide/': [
23+
"/guide/": [
3124
{
32-
text: 'Introduction',
25+
text: "Introduction",
3326
collapsed: false,
34-
items: [
35-
{ text: 'Getting Started', link: '/guide/getting-started' },
36-
]
27+
items: [{ text: "Getting Started", link: "/guide/getting-started" }],
3728
},
3829
{
39-
text: 'Advanced',
30+
text: "Advanced",
4031
collapsed: false,
4132
items: [
42-
{ text: 'Theme System', link: '/guide/theme' },
43-
{ text: 'Color System', link: '/guide/colors' },
44-
{ text: 'Text Styles', link: '/guide/textstyles' },
45-
{ text: 'Icon System', link: '/guide/icons' },
46-
{ text: 'Utility Functions', link: '/guide/utils' },
47-
{ text: 'Platform Support', link: '/guide/multiplatform' },
48-
{ text: 'Best Practices', link: '/guide/best-practices' },
49-
]
50-
}
33+
{ text: "Theme System", link: "/guide/theme" },
34+
{ text: "Color System", link: "/guide/colors" },
35+
{ text: "Text Styles", link: "/guide/textstyles" },
36+
{ text: "Icon System", link: "/guide/icons" },
37+
{ text: "Utility Functions", link: "/guide/utils" },
38+
{ text: "Platform Support", link: "/guide/multiplatform" },
39+
{ text: "Best Practices", link: "/guide/best-practices" },
40+
],
41+
},
5142
],
52-
'/components/': [
43+
"/components/": [
5344
{
54-
text: 'Components',
45+
text: "Components",
5546
collapsed: false,
56-
items: [
57-
{ text: 'Overview', link: '/components/' },
58-
]
47+
items: [{ text: "Overview", link: "/components/" }],
5948
},
6049
{
61-
text: 'Scaffold Components',
50+
text: "Scaffold Components",
6251
collapsed: false,
63-
items: [
64-
{ text: 'Scaffold', link: '/components/scaffold' },
65-
]
52+
items: [{ text: "Scaffold", link: "/components/scaffold" }],
6653
},
6754
{
68-
text: 'Basic Components',
55+
text: "Basic Components",
6956
collapsed: false,
7057
items: [
71-
{ text: 'Surface', link: '/components/surface' },
72-
{ text: 'TopAppBar', link: '/components/topappbar' },
73-
{ text: 'NavigationBar', link: '/components/navigationbar' },
74-
{ text: 'TabRow', link: '/components/tabrow' },
75-
{ text: 'Card', link: '/components/card' },
76-
{ text: 'BasicComponent', link: '/components/basiccomponent' },
77-
{ text: 'Button', link: '/components/button' },
78-
{ text: 'IconButton', link: '/components/iconbutton' },
79-
{ text: 'Text', link: '/components/text' },
80-
{ text: 'SmallTitle', link: '/components/smalltitle' },
81-
{ text: 'TextField', link: '/components/textfield' },
82-
{ text: 'Switch', link: '/components/switch' },
83-
{ text: 'Checkbox', link: '/components/checkbox' },
84-
{ text: 'Slider', link: '/components/slider' },
85-
{ text: 'ProgressIndicator', link: '/components/progressindicator' },
86-
{ text: 'Icon', link: '/components/icon' },
87-
{ text: 'FloatingActionButton', link: '/components/floatingactionbutton' },
88-
{ text: 'FloatingToolbar', link: '/components/floatingtoolbar' },
89-
{ text: 'Divider', link: '/components/divider' },
90-
{ text: 'PullToRefresh', link: '/components/pulltorefresh' },
91-
{ text: 'SearchBar', link: '/components/searchbar' },
92-
{ text: 'ColorPalette', link: '/components/colorpalette' },
93-
{ text: 'ColorPicker', link: '/components/colorpicker' },
94-
{ text: 'ListPopup', link: '/components/listpopup' },
95-
]
58+
{ text: "Surface", link: "/components/surface" },
59+
{ text: "TopAppBar", link: "/components/topappbar" },
60+
{ text: "NavigationBar", link: "/components/navigationbar" },
61+
{ text: "TabRow", link: "/components/tabrow" },
62+
{ text: "Card", link: "/components/card" },
63+
{ text: "BasicComponent", link: "/components/basiccomponent" },
64+
{ text: "Button", link: "/components/button" },
65+
{ text: "IconButton", link: "/components/iconbutton" },
66+
{ text: "Text", link: "/components/text" },
67+
{ text: "SmallTitle", link: "/components/smalltitle" },
68+
{ text: "TextField", link: "/components/textfield" },
69+
{ text: "Switch", link: "/components/switch" },
70+
{ text: "Checkbox", link: "/components/checkbox" },
71+
{ text: "Slider", link: "/components/slider" },
72+
{ text: "ProgressIndicator", link: "/components/progressindicator", },
73+
{ text: "Icon", link: "/components/icon" },
74+
{ text: "FloatingActionButton", link: "/components/floatingactionbutton", },
75+
{ text: "FloatingToolbar", link: "/components/floatingtoolbar" },
76+
{ text: "Divider", link: "/components/divider" },
77+
{ text: "PullToRefresh", link: "/components/pulltorefresh" },
78+
{ text: "SearchBar", link: "/components/searchbar" },
79+
{ text: "ColorPalette", link: "/components/colorpalette" },
80+
{ text: "ColorPicker", link: "/components/colorpicker" },
81+
{ text: "ListPopup", link: "/components/listpopup" },
82+
],
9683
},
9784
{
98-
text: 'Extended Components',
85+
text: "Extended Components",
9986
collapsed: false,
10087
items: [
101-
{ text: 'SuperArrow', link: '/components/superarrow' },
102-
{ text: 'SuperSwitch', link: '/components/superswitch' },
103-
{ text: 'SuperCheckbox', link: '/components/supercheckbox' },
104-
{ text: 'SuperDropdown', link: '/components/superdropdown' },
105-
{ text: 'SuperSpinner', link: '/components/superspinner' },
106-
{ text: 'SuperDialog', link: '/components/superdialog' },
107-
{ text: 'SuperBottomSheet', link: '/components/superbottomsheet' },
108-
]
88+
{ text: "SuperArrow", link: "/components/superarrow" },
89+
{ text: "SuperSwitch", link: "/components/superswitch" },
90+
{ text: "SuperCheckbox", link: "/components/supercheckbox" },
91+
{ text: "SuperDropdown", link: "/components/superdropdown" },
92+
{ text: "SuperSpinner", link: "/components/superspinner" },
93+
{ text: "SuperDialog", link: "/components/superdialog" },
94+
{ text: "SuperBottomSheet", link: "/components/superbottomsheet" },
95+
],
10996
},
110-
]
97+
],
11198
},
112-
}
113-
})
99+
},
100+
});

docs/.vitepress/locales/index.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
import { defineConfig } from 'vitepress'
2-
import en_US from './en_US'
3-
import zh_CN from './zh_CN'
1+
import { defineConfig } from "vitepress";
2+
import en_US from "./en_US";
3+
import zh_CN from "./zh_CN";
44
export default defineConfig({
55
locales: {
66
root: {
7-
label: 'English',
7+
label: "English",
88
lang: en_US.lang,
99
themeConfig: en_US.themeConfig,
1010
description: en_US.description,
1111
},
1212
zh_CN: {
13-
label: '简体中文',
13+
label: "简体中文",
1414
lang: zh_CN.lang,
1515
themeConfig: zh_CN.themeConfig,
1616
description: zh_CN.description,
1717
},
18-
}
19-
})
18+
},
19+
});

0 commit comments

Comments
 (0)