Skip to content

Commit 4172da5

Browse files
authored
Merge pull request #480 from star-hamster/dev
doc(Typography): 增加文档预览
2 parents 0bdbe03 + ffc4dcd commit 4172da5

File tree

1 file changed

+64
-48
lines changed

1 file changed

+64
-48
lines changed

packages/core/src/Typography/README.md

Lines changed: 64 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -3,56 +3,62 @@ Typography 排版
33

44
包含 H1~H6,`<U>`, `<S>`, `<P>` 等,类似于 HTML 中的标签。
55

6-
[`H1~H6`](#标题) · [`<Del>`](#删除线) · [`<S>`](#删除线) · [`<U>`](#下划线) · [`<Strong>`](#加粗) · [`<P />`](#段落) · [`<Br />`](#换行) · [`<Hr />`](#水平线) · [`<Div />`](#div)
7-
8-
![](https://user-images.githubusercontent.com/57083007/146734264-8cb81fae-c4b5-4e02-9794-627442e580c9.png)<!--rehype:style=zoom: 33%;float: right; margin-left: 15px;-->
9-
106
### 基础示例
117

128
### 标题
139

14-
```jsx
15-
import { Fragment } from 'react';
16-
import { H1, H2, H3, H4, H5, H6 } from '@uiw/react-native';
17-
18-
function Demo() {
10+
```jsx mdx:preview
11+
import React from "react"
12+
import { View } from 'react-native';
13+
import H1 from '@uiw/react-native/lib/Typography/H1';
14+
import H2 from '@uiw/react-native/lib/Typography/H2';
15+
import H3 from '@uiw/react-native/lib/Typography/H3';
16+
import H4 from '@uiw/react-native/lib/Typography/H4';
17+
import H5 from '@uiw/react-native/lib/Typography/H5';
18+
import H6 from '@uiw/react-native/lib/Typography/H6';
19+
20+
export default function Demo() {
1921
return (
20-
<Fragment>
21-
<H1>这是标题一</H1>
22-
<H2>这是标题二</H2>
23-
<H3>这是标题二</H3>
24-
<H4>这是标题二</H4>
25-
<H5>这是标题二</H5>
26-
<H6>这是标题二</H6>
27-
</Fragment>
28-
);
22+
<>
23+
<View><H1>这是标题一</H1></View>
24+
<View><H2>这是标题二</H2></View>
25+
<View><H3>这是标题三</H3></View>
26+
<View><H4>这是标题四</H4></View>
27+
<View><H5>这是标题五</H5></View>
28+
<View><H6>这是标题六</H6></View>
29+
</>
30+
)
2931
}
3032
```
3133

3234
### 删除线
3335

3436
`<s>` 标签是 `<strike>` 标签的缩写版本
3537

36-
```jsx
37-
import { Fragment } from 'react';
38-
import { Del, S } from '@uiw/react-native';
38+
```jsx mdx:preview
39+
import React from "react"
40+
import { View } from 'react-native';
41+
import Del from '@uiw/react-native/lib/Typography/S';
42+
import S from '@uiw/react-native/lib/Typography/S';
3943

40-
function Demo() {
44+
export default function Demo() {
4145
return (
42-
<Fragment>
43-
<S>这段字符串中间有条删除线</S>
44-
<Del>这段字符串中间有条删除线</Del>
45-
</Fragment>
46+
<>
47+
<View><S>这段字符串中间有条删除线</S></View>
48+
<View><Del>删除线的两种写法😂</Del></View>
49+
</>
4650
);
4751
}
4852
```
4953

5054
### 下划线
5155

52-
```jsx
53-
import { U } from '@uiw/react-native';
56+
```jsx mdx:preview
57+
import React from "react"
58+
import { View } from 'react-native';
59+
import U from '@uiw/react-native/lib/Typography/U';
5460

55-
function Demo() {
61+
export default function Demo() {
5662
return (
5763
<U>这段文字有下划线</U>
5864
);
@@ -61,10 +67,12 @@ function Demo() {
6167

6268
### 加粗
6369

64-
```jsx
65-
import { Strong } from '@uiw/react-native';
70+
```jsx mdx:preview
71+
import React from "react"
72+
import { View } from 'react-native';
73+
import Strong from '@uiw/react-native/lib/Typography/Strong';
6674

67-
function Demo() {
75+
export default function Demo() {
6876
return (
6977
<Strong>这段文字加粗</Strong>
7078
);
@@ -73,11 +81,12 @@ function Demo() {
7381

7482
### 换行
7583

76-
```jsx
84+
```jsx mdx:preview
85+
import React from "react"
7786
import { Text } from 'react-native';
78-
import { Br } from '@uiw/react-native';
87+
import Br from '@uiw/react-native/lib/Typography/Br';
7988

80-
function Demo() {
89+
export default function Demo() {
8190
return (
8291
<Text>文本开始<Br />换行结束</Text>
8392
);
@@ -86,23 +95,28 @@ function Demo() {
8695

8796
### 段落
8897

89-
```jsx
90-
import { Br } from '@uiw/react-native';
98+
```jsx mdx:preview
99+
import React from "react"
100+
import P from '@uiw/react-native/lib/Typography/P';
91101

92-
function Demo() {
102+
export default function Demo() {
93103
return (
104+
<>
94105
<P>这是一个段落{`<P>`}</P>
106+
<P>这是第二个段落{`<P>`}</P>
107+
</>
95108
);
96109
}
97110
```
98111

99112
### Div
100113

101-
```jsx
114+
```jsx mdx:preview
115+
import React from "react"
102116
import { View, Text } from 'react-native';
103-
import { Div } from '@uiw/react-native';
117+
import Div from '@uiw/react-native/lib/Typography/Div';
104118

105-
function Demo() {
119+
export default function Demo() {
106120
return (
107121
<View>
108122
<Div>这是一段文本{`<Div>`}</Div>
@@ -118,11 +132,12 @@ function Demo() {
118132

119133
### 水平线
120134

121-
```jsx
135+
```jsx mdx:preview
136+
import React from "react"
122137
import { View, Text } from 'react-native';
123-
import { Hr } from '@uiw/react-native';
138+
import Hr from '@uiw/react-native/lib/Typography/Hr';
124139

125-
function Demo() {
140+
export default function Demo() {
126141
return (
127142
<View>
128143
<Text>一段文本</Text>
@@ -135,11 +150,12 @@ function Demo() {
135150

136151
### 可高亮文本 RnText
137152

138-
```jsx
153+
```jsx mdx:preview
154+
import React from "react"
139155
import { View } from 'react-native';
140-
import { RnText } from '@uiw/react-native';
156+
import RnText from '@uiw/react-native/lib/Typography/RnText';
141157

142-
function Demo() {
158+
export default function Demo() {
143159
return (
144160
<View>
145161
<RnText type="header" label="react-native-uiw" />
@@ -150,4 +166,4 @@ function Demo() {
150166
</View>
151167
);
152168
}
153-
```
169+
```

0 commit comments

Comments
 (0)