Skip to content

Commit 6912c88

Browse files
committed
refactor(docs): 调整文档的实现
1 parent 462a0d8 commit 6912c88

5 files changed

Lines changed: 34 additions & 33 deletions

File tree

apps/docs/src/components/demo/button/api.zh-Hans.json

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -832,13 +832,6 @@
832832
"type": "string | undefined",
833833
"reactive": true
834834
},
835-
{
836-
"name": "display",
837-
"summary": "按钮上的显示内容\n\n",
838-
"type": "\"icon\" | \"text\" | \"all\" | undefined",
839-
"def": "'all'\n\n",
840-
"reactive": true
841-
},
842835
{
843836
"name": "style",
844837
"summary": "组件根元素的样式\n\n",

apps/docs/src/components/demo/button/print.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { PrintButton } from '@cmfx/components';
77
import type { JSX } from 'solid-js';
88
import { Portal } from 'solid-js/web';
99

10-
import { arraySelector, boolSelector, buttonKindSelector, paletteSelector } from '@docs/components/base';
10+
import { boolSelector, buttonKindSelector, paletteSelector } from '@docs/components/base';
1111

1212
export default function (props: MountProps): JSX.Element {
1313
let elem: HTMLDivElement;
@@ -16,7 +16,6 @@ export default function (props: MountProps): JSX.Element {
1616
const [Disabled, disabled] = boolSelector('_d.demo.disabled');
1717
const [Rounded, rounded] = boolSelector('_d.demo.rounded');
1818
const [Palette, palette] = paletteSelector();
19-
const [Display, display] = arraySelector('display', PrintButton.displays);
2019

2120
return (
2221
<div ref={el => (elem = el)}>
@@ -25,7 +24,6 @@ export default function (props: MountProps): JSX.Element {
2524
<Disabled />
2625
<Rounded />
2726
<Palette />
28-
<Display />
2927
</Portal>
3028

3129
<PrintButton.Root
@@ -34,7 +32,6 @@ export default function (props: MountProps): JSX.Element {
3432
rounded={rounded()}
3533
kind={kind()}
3634
palette={palette()}
37-
display={display()}
3835
/>
3936
</div>
4037
);

apps/docs/src/components/demo/icon/api.zh-Hans.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"name": "easing",
2020
"summary": "缓动函数\n\n",
2121
"remarks": "如果需要自定义缓动函数,可以通过使用\n`registerEasing`\n方法进行注册。\n\n",
22-
"type": "\"circ-in\" | \"circ-out\" | \"circ-in-out\" | \"cubic-in\" | \"cubic-out\" | \"cubic-in-out\" | \"elastic-in\" | \"elastic-out\" | \"elastic-in-out\" | \"expo-in\" | \"expo-out\" | \"expo-in-out\" | \"linear\" | \"quad-in\" | \"quad-out\" | \"quad-in-out\" | \"quart-in\" | \"quart-out\" | \"quart-in-out\" | \"quint-in\" | \"quint-out\" | \"quint-in-out\" | \"sine-in\" | \"sine-out\" | \"sine-in-out\" | undefined"
22+
"type": "string | undefined"
2323
},
2424
{
2525
"name": "rotation",

apps/docs/src/components/demo/icon/iconset.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@ export default function (props: MountProps): JSX.Element {
2626
<Button.Root palette={palette()}>
2727
<IconSet.Root
2828
class="aspect-square w-8!"
29-
ref={el => {
30-
aref = el;
31-
}}
29+
ref={el => (aref = el)}
3230
icons={{
3331
face: <IconFace />,
3432
close: <IconClose />,

apps/docs/src/components/demo/icon/text.tsx

Lines changed: 31 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,45 @@
22
//
33
// SPDX-License-Identifier: MIT
44

5+
import { joinClass, type MountProps } from '@cmfx/components';
6+
import type { JSX } from 'solid-js';
7+
import { Portal } from 'solid-js/web';
58
import IconClose from '~icons/material-symbols/close';
69
import IconFace from '~icons/material-symbols/face';
710
import IconPerson from '~icons/material-symbols/person';
811

9-
export default function () {
12+
import { paletteSelector } from '@docs/components/base';
13+
14+
export default function (props: MountProps): JSX.Element {
15+
const [Palette, palette] = paletteSelector();
16+
1017
return (
1118
<>
12-
<IconFace class="rounded-full bg-palette-bg-low hover:text-palette-fg-high" />
13-
<IconPerson class="border border-palette-fg-high" />
19+
<Portal mount={props.mount}>
20+
<Palette />
21+
</Portal>
22+
23+
<div class={joinClass(palette())}>
24+
<IconFace class="rounded-full bg-palette-bg-low hover:text-palette-fg-high" />
25+
<IconPerson class="border border-palette-fg-high" />
1426

15-
<span class="flex w-full items-center border border-red-500 bg-palette-fg-high">
16-
<IconFace />
17-
与文字文字平行
18-
<IconClose />
19-
</span>
20-
<span class="flex w-full items-center border border-red-500 text-8xl">
21-
<IconFace />
22-
与文字平行 6rem
23-
<IconClose />
24-
</span>
27+
<span class="flex w-full items-center border border-red-500 bg-palette-fg-high">
28+
<IconFace />
29+
与文字文字平行
30+
<IconClose />
31+
</span>
32+
<span class="flex w-full items-center border border-red-500 text-8xl">
33+
<IconFace />
34+
与文字平行 6rem
35+
<IconClose />
36+
</span>
2537

26-
<span class="flex h-12 w-full items-center border border-red-500">
27-
<IconFace />
28-
与文字文字平行
29-
<IconFace />
30-
</span>
38+
<span class="flex h-12 w-full items-center border border-red-500 bg-palette-bg text-palette-fg">
39+
<IconFace />
40+
与文字文字平行
41+
<IconFace />
42+
</span>
43+
</div>
3144
</>
3245
);
3346
}

0 commit comments

Comments
 (0)