Skip to content

Commit c7122a2

Browse files
committed
WIP 9
1 parent c9bb00a commit c7122a2

File tree

3 files changed

+152
-11
lines changed

3 files changed

+152
-11
lines changed

docs/.vitepress/config.mts

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,6 @@ export default defineConfig({
9292
text: '容器组件',
9393
items: [
9494
{ text: 'Card', link: '/components/card' },
95-
{ text: 'Dialog', link: '/components/dialog' },
96-
{ text: 'ListPopup', link: '/components/listpopup' },
9795
]
9896
},
9997
{
@@ -118,10 +116,26 @@ export default defineConfig({
118116
]
119117
},
120118
{
121-
text: '其他组件',
119+
text: '搜索组件',
120+
items: [
121+
{ text: 'SearchBar', link: '/components/searchview' },
122+
]
123+
},
124+
{
125+
text: '取色组件',
122126
items: [
123127
{ text: 'ColorPicker', link: '/components/colorpicker' },
124-
{ text: 'SearchBar', link: '/components/searchbar' },
128+
]
129+
},
130+
{
131+
text: '扩展组件',
132+
items: [
133+
{ text: 'SuperArrow', link: '/components/superarrow' },
134+
{ text: 'SuperSwitch', link: '/components/superswitch' },
135+
{ text: 'SuperCheckBox', link: '/components/supercheckbox' },
136+
{ text: 'SuperDropdown', link: '/components/superdropdown' },
137+
{ text: 'SuperSpinner', link: '/components/superspinner' },
138+
{ text: 'SuperDialog', link: '/components/superdialog' },
125139
]
126140
}
127141
]

docs/components/card.md

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
# Card
2+
3+
`Card` 是 Miuix 中的基础容器组件,用于承载相关内容和操作。它提供了具有 Miuix 风格的卡片容器,适用于信息展示、内容分组等场景。
4+
5+
## 引入
6+
7+
```kotlin
8+
import top.yukonga.miuix.kmp.basic.Card
9+
```
10+
11+
## 基本用法
12+
13+
Card 组件可以用于包装和组织内容:
14+
15+
```kotlin
16+
Card {
17+
Text("这是卡片内容")
18+
}
19+
```
20+
21+
## 属性
22+
23+
### Card 属性
24+
25+
| 属性名 | 类型 | 默认值 | 说明 |
26+
| ------------ | ---------------------------------- | --------------------------- | ------------------------ |
27+
| modifier | Modifier | Modifier | 应用于卡片的修饰符 |
28+
| cornerRadius | Dp | CardDefaults.CornerRadius | 卡片圆角半径 |
29+
| insideMargin | PaddingValues | CardDefaults.InsideMargin | 卡片内部边距 |
30+
| color | Color | CardDefaults.DefaultColor() | 卡片背景颜色 |
31+
| content | @Composable ColumnScope.() -> Unit | - | 卡片内容区域的可组合函数 |
32+
33+
### CardDefaults 对象
34+
35+
CardDefaults 对象提供了卡片组件的默认值和颜色配置。
36+
37+
#### 常量
38+
39+
| 常量名 | 类型 || 说明 |
40+
| ------------ | ------------- | ------------------- | -------------- |
41+
| CornerRadius | Dp | 16.dp | 卡片的圆角半径 |
42+
| InsideMargin | PaddingValues | PaddingValues(0.dp) | 卡片的内部边距 |
43+
44+
#### 方法
45+
46+
| 方法名 | 返回类型 | 说明 |
47+
| -------------- | -------- | ------------------ |
48+
| DefaultColor() | Color | 创建卡片的默认颜色 |
49+
50+
## 进阶用法
51+
52+
### 自定义样式卡片
53+
54+
```kotlin
55+
Card(
56+
cornerRadius = 8.dp,
57+
insideMargin = PaddingValues(16.dp),
58+
color = Color.LightGray.copy(alpha = 0.5f)
59+
) {
60+
Text("自定义样式卡片")
61+
}
62+
```
63+
64+
### 内容丰富的卡片
65+
66+
```kotlin
67+
Card(
68+
modifier = Modifier.padding(16.dp),
69+
insideMargin = PaddingValues(16.dp)
70+
) {
71+
Text(
72+
text = "卡片标题",
73+
style = MiuixTheme.textStyles.title2
74+
)
75+
Spacer(modifier = Modifier.height(8.dp))
76+
Text(
77+
text = "这是卡片的详细内容描述,可以包含多行文本信息。"
78+
)
79+
Spacer(modifier = Modifier.height(16.dp))
80+
Row(
81+
modifier = Modifier.fillMaxWidth(),
82+
horizontalArrangement = Arrangement.End
83+
) {
84+
TextButton(
85+
text = "取消",
86+
onClick = { /* 处理取消事件 */ }
87+
)
88+
Spacer(modifier = Modifier.width(8.dp))
89+
TextButton(
90+
text = "确定",
91+
colors = textButtonColorsPrimary(),
92+
onClick = { /* 处理取消事件 */ }
93+
)
94+
}
95+
}
96+
```
97+
98+
### 列表中的卡片
99+
100+
```kotlin
101+
LazyColumn {
102+
items(5) { index ->
103+
Card(
104+
modifier = Modifier
105+
.fillMaxWidth()
106+
.padding(horizontal = 16.dp, vertical = 8.dp),
107+
insideMargin = PaddingValues(16.dp)
108+
) {
109+
Text("列表项 ${index + 1}")
110+
}
111+
}
112+
}
113+
```

docs/components/index.md

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,9 @@ Miuix 提供了丰富的 UI 组件,严格遵循 Xiaomi HyperOS 设计规范。
2020

2121
## 容器组件
2222

23-
| 组件 | 描述 | 常见用途 |
24-
| ---------------------------------- | ------------------ | ------------------ |
25-
| [Card](/components/card) | 包含相关信息的容器 | 信息展示、内容分组 |
26-
| [Dialog](/components/dialog) | 模态弹窗 | 重要提示、操作确认 |
27-
| [ListPopup](/components/listpopup) | 弹出的列表选择框 | 选项选择、快捷操作 |
23+
| 组件 | 描述 | 常见用途 |
24+
| ------------------------ | ------------------ | ------------------ |
25+
| [Card](/components/card) | 包含相关信息的容器 | 信息展示、内容分组 |
2826

2927
## 导航组件
3028

@@ -47,9 +45,25 @@ Miuix 提供了丰富的 UI 组件,严格遵循 Xiaomi HyperOS 设计规范。
4745
| ------------------------------------------ | ---------------- | ------------------ |
4846
| [PullToRefresh](/components/pulltorefresh) | 下拉触发刷新操作 | 数据更新、页面刷新 |
4947

50-
## 其他组件
48+
## 搜索组件
49+
50+
| 组件 | 描述 | 常见用途 |
51+
| ---------------------------------- | ---------------- | ------------------ |
52+
| [SearchBar](/components/searchbar) | 执行搜索的输入框 | 内容搜索、快速查找 |
53+
54+
## 取色组件
5155

5256
| 组件 | 描述 | 常见用途 |
5357
| -------------------------------------- | -------------- | ------------------ |
5458
| [ColorPicker](/components/colorpicker) | 选择颜色的控件 | 主题设置、颜色选择 |
55-
| [SearchBar](/components/searchbar) | 搜索输入框 | 内容搜索、快速查找 |
59+
60+
## 扩展组件
61+
62+
| 组件 | 描述 | 常见用途 |
63+
| ------------------------------------------ | ---------------------------------- | -------------------------- |
64+
| [SuperArrow](/components/superarrow) | 基于 BasicComponent 的带箭头组件 | 指示可点击、导航提示 |
65+
| [SuperSwitch](/components/superswitch) | 基于 BasicComponent 的开关组件 | 设置项开关、功能启用/禁用 |
66+
| [SuperCheckBox](/components/supercheckbox) | 基于 BasicComponent 的复选框组件 | 多项选择、条款同意 |
67+
| [SuperDropdown](/components/superdropdown) | 基于 BasicComponent 的下拉菜单组件 | 选项选择、功能列表 |
68+
| [SuperSpinner](/components/superspinner) | 基于 BasicComponent 的高级菜单组件 | 复杂选项选择、复杂功能列表 |
69+
| [SuperDialog](/components/superdialog) | 基于 BasicComponent 的对话弹窗组件 | 提示、确认操作 |

0 commit comments

Comments
 (0)