Skip to content

Commit 387c45b

Browse files
committed
feat: ✨ add link docs and add grid/radio/link slot content.
1 parent 3184e2d commit 387c45b

File tree

19 files changed

+423
-44
lines changed

19 files changed

+423
-44
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { Catalog } from '@/app/_components/catalog'
2+
3+
import { catalogList } from '../../grid/markdown'
4+
5+
export default function Page() {
6+
return <Catalog items={catalogList} />
7+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { Catalog } from '@/app/_components/catalog'
2+
3+
import { catalogList } from '../../link/markdown'
4+
5+
export default function Page() {
6+
return <Catalog items={catalogList} />
7+
}
8+
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { Catalog } from '@/app/_components/catalog'
2+
3+
import { catalogList } from '../../radio/markdown/read'
4+
5+
export default function Page() {
6+
return <Catalog items={catalogList} />
7+
}
8+
Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,39 @@
1-
// Auto-generated catalog from traditional-example.mdx
1+
// Auto-generated catalog from app/(main)/grid/markdown/grid-markdown.mdx
22
export const catalogList = [
33
{
4-
level: 3,
5-
text: '基本用法',
4+
"level": 3,
5+
"text": "基本用法"
66
},
77
{
8-
level: 3,
9-
text: '子元素从上到下排列',
8+
"level": 3,
9+
"text": "子元素从上到下排列"
1010
},
1111
{
12-
level: 3,
13-
text: '位置偏移',
12+
"level": 3,
13+
"text": "位置偏移"
1414
},
1515
{
16-
level: 3,
17-
text: '圣杯布局',
16+
"level": 3,
17+
"text": "圣杯布局"
1818
},
1919
{
20-
level: 3,
21-
text: 'Areas 关键字',
20+
"level": 3,
21+
"text": "Areas 关键字"
2222
},
2323
{
24-
level: 3,
25-
text: '水平对齐',
24+
"level": 3,
25+
"text": "水平对齐"
2626
},
2727
{
28-
level: 3,
29-
text: '垂直对齐',
28+
"level": 3,
29+
"text": "垂直对齐"
3030
},
3131
{
32-
level: 3,
33-
text: '响应式流动布局',
32+
"level": 3,
33+
"text": "响应式流动布局"
3434
},
3535
{
36-
level: 3,
37-
text: '响应式断点布局',
38-
},
36+
"level": 3,
37+
"text": "响应式断点布局"
38+
}
3939
];
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
export * from "./catalog";
12
export * from "./grid-markdown";
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Auto-generated catalog from app/(main)/link/markdown/link-markdown.mdx
2+
export const catalogList = [
3+
{
4+
"level": 3,
5+
"text": "基本用法"
6+
},
7+
{
8+
"level": 3,
9+
"text": "新标签页打开"
10+
},
11+
{
12+
"level": 3,
13+
"text": "带图标的链接"
14+
},
15+
{
16+
"level": 3,
17+
"text": "块级 / 卡片链接"
18+
},
19+
{
20+
"level": 3,
21+
"text": "Ref 使用"
22+
}
23+
];
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export * from "./catalog";
2+
export * from "./link-markdown";
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
import {
2+
ImageTypography,
3+
AvatarM,
4+
CodeBlock,
5+
H1,
6+
Divide,
7+
H3Sub,
8+
Code,
9+
} from "@/app/_components/typography";
10+
import {
11+
BasicExample,
12+
CardLinkExample,
13+
DisabledExample,
14+
IconLinkExample,
15+
NewTabExample,
16+
RefExample,
17+
} from "./read";
18+
19+
<H1 subheading="超链接组件,基于 HTML <a> 封装并提供 disabled 等能力">Link</H1>
20+
21+
{/* ### 基本用法 */}
22+
23+
<H3Sub
24+
sub={
25+
<>
26+
最简单的用法,直接传入 <Code>href</Code> 与样式即可。
27+
</>
28+
}
29+
>
30+
{"基本用法"}
31+
</H3Sub>
32+
<BasicExample />
33+
34+
<H3Sub
35+
sub={
36+
<>
37+
通过 <Code>disabled</Code> 可以阻止默认跳转,同时不会触发{" "}
38+
<Code>onClick</Code>
39+
回调。
40+
</>
41+
}
42+
>
43+
{"禁用状态"}
44+
</H3Sub>
45+
<DisabledExample />
46+
47+
{/* ### 新标签页打开 */}
48+
49+
<H3Sub
50+
sub={
51+
<>
52+
通过设置 <Code>target</Code> 与 <Code>rel</Code>
53+
,可以在新标签页打开外部链接。
54+
</>
55+
}
56+
>
57+
{"新标签页打开"}
58+
</H3Sub>
59+
<NewTabExample />
60+
61+
{/* ### 带图标的链接 */}
62+
63+
<H3Sub
64+
sub={
65+
<>
66+
通过 <Code>inline-flex</Code> / <Code>gap</Code>{" "}
67+
等样式把图标与文本放在一起。
68+
</>
69+
}
70+
>
71+
{"带图标的链接"}
72+
</H3Sub>
73+
<IconLinkExample />
74+
75+
{/* ### 块级 / 卡片链接 */}
76+
77+
<H3Sub
78+
sub={
79+
<>
80+
让 <Code>Link</Code> 作为块级元素(<Code>block</Code>),配合边框/hover
81+
样式即可实现“整块可点”的卡片链接。
82+
</>
83+
}
84+
>
85+
{"块级 / 卡片链接"}
86+
</H3Sub>
87+
<CardLinkExample />
88+
89+
{/* ### Ref 使用 */}
90+
91+
<H3Sub
92+
sub={
93+
<>
94+
<Code>Link</Code> 支持 <Code>ref</Code>(<Code>forwardRef</Code>
95+
),便于聚焦等操作。
96+
</>
97+
}
98+
>
99+
{"Ref 使用"}
100+
</H3Sub>
101+
<RefExample />
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
'use client';
2+
import React from 'react';
3+
4+
import LinkMarkdownMDX from './link-markdown.mdx';
5+
6+
export function LinkMarkdown() {
7+
return <LinkMarkdownMDX />;
8+
}
9+
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import React from 'react';
2+
3+
import { CodePreview } from '@/app/_components/code-preview';
4+
5+
const code = `
6+
function App() {
7+
return (
8+
<div className="space-x-4">
9+
<Link href="https://ui.condevtools.com/" className="text-blue-400 hover:text-blue-300 underline">
10+
condev ui
11+
</Link>
12+
</div>
13+
);
14+
}
15+
`;
16+
17+
export function BasicExample() {
18+
return <CodePreview code={code} />;
19+
}
20+

0 commit comments

Comments
 (0)