Skip to content

Commit fb40ee2

Browse files
committed
feat: convert demo files from .md to .tsx for editor support
Migrate demo files from markdown format to TypeScript/React format to support more code editors with proper syntax highlighting and type checking.
1 parent 68dc4b8 commit fb40ee2

File tree

705 files changed

+12906
-8419
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

705 files changed

+12906
-8419
lines changed

apps/docs/src/components/demo-block/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ export const DemoBlock = ({ component: Component, source, title, description }:
158158
<StackBlitzIcon />
159159
</button>
160160
</Tooltip>
161-
<Tooltip title={copied ? 'Copied!' : 'Copy code'}>
161+
<Tooltip title={copied ? s.codeBlock.copied : s.codeBlock.copyCode}>
162162
<button
163163
className="demo-block__action-btn"
164164
onClick={handleCopy}
@@ -167,7 +167,7 @@ export const DemoBlock = ({ component: Component, source, title, description }:
167167
</button>
168168
</Tooltip>
169169
{isEditing && (
170-
<Tooltip title="Reset demo">
170+
<Tooltip title={s.codeBlock.resetDemo}>
171171
<button
172172
className="demo-block__action-btn"
173173
onClick={handleReset}

apps/docs/src/locale/en_US.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ const en_US: SiteLocale = {
8080
codeBlock: {
8181
showCode: 'Show Code',
8282
hideCode: 'Hide Code',
83+
copyCode: 'Copy Code',
84+
resetDemo: 'Reset Demo',
85+
copied: 'Copied',
8386
openInStackBlitz: 'Open in StackBlitz',
8487
openInCodeSandbox: 'Open in CodeSandbox',
8588
},

apps/docs/src/locale/types.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ export type SiteLocale = {
7171
codeBlock: {
7272
showCode: string;
7373
hideCode: string;
74+
copyCode: string;
75+
resetDemo: string;
76+
copied: string;
7477
openInStackBlitz: string;
7578
openInCodeSandbox: string;
7679
};

apps/docs/src/locale/zh_CN.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ const zh_CN: SiteLocale = {
7474
codeBlock: {
7575
showCode: '显示代码',
7676
hideCode: '隐藏代码',
77+
copyCode: '复制代码',
78+
resetDemo: '重置演示',
79+
copied: '已复制',
7780
openInStackBlitz: '在 StackBlitz 中打开',
7881
openInCodeSandbox: '在 CodeSandbox 中打开',
7982
},
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import React from 'react';
2+
import { Alert } from '@tiny-design/react';
3+
4+
export default function BasicDemo() {
5+
return <Alert>Info alert</Alert>;
6+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import React from 'react';
2+
import { Alert } from '@tiny-design/react';
3+
4+
export default function ClosableDemo() {
5+
return (
6+
<>
7+
<Alert closable>Info alert</Alert>
8+
<Alert closable type="success">Success alert</Alert>
9+
<Alert closable type="warning">Warning alert</Alert>
10+
<Alert closable type="error">Error alert</Alert>
11+
</>
12+
);
13+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import React from 'react';
2+
import { Alert } from '@tiny-design/react';
3+
4+
export default function CloseBtnDemo() {
5+
return <Alert closeText="close now">Info alert</Alert>;
6+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import React from 'react';
2+
import { Alert } from '@tiny-design/react';
3+
4+
export default function IconDemo() {
5+
return (
6+
<>
7+
<Alert icon>Info alert</Alert>
8+
<Alert icon type="success">Success alert</Alert>
9+
<Alert icon type="warning">Warning alert</Alert>
10+
<Alert icon type="error">Error alert</Alert>
11+
12+
<Alert icon iconSize={20} title="INFO">Info alert</Alert>
13+
<Alert icon iconSize={20} type="success" title="SUCCESS">Success alert</Alert>
14+
<Alert icon iconSize={20} type="warning" title="WARNING">Warning alert</Alert>
15+
<Alert icon iconSize={20} type="error" title="ERROR">Error alert</Alert>
16+
</>
17+
);
18+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import React from 'react';
2+
import { Alert } from '@tiny-design/react';
3+
4+
export default function TitleDemo() {
5+
return (
6+
<Alert title="Well done!" type="success">
7+
Aww yeah, you successfully read this important alert message. This example text is going to run a bit longer so that you can see how spacing within an alert works with this kind of content.
8+
</Alert>
9+
);
10+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import React from 'react';
2+
import { Alert } from '@tiny-design/react';
3+
4+
export default function TypeDemo() {
5+
return (
6+
<>
7+
<Alert>Info alert</Alert>
8+
<Alert type="success">Success alert</Alert>
9+
<Alert type="warning">Warning alert</Alert>
10+
<Alert type="error">Error alert</Alert>
11+
</>
12+
);
13+
}

0 commit comments

Comments
 (0)