forked from ant-design/ant-design
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Timeline.Item support label (ant-design#21560)
* feat: Timeline add label * improve label style with mode * update snapshot * use optional chaining * add doc * Update label.md Co-authored-by: 偏右 <[email protected]>
- Loading branch information
1 parent
a321b5e
commit 3269d8c
Showing
8 changed files
with
250 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
--- | ||
order: 5 | ||
title: | ||
zh-CN: 标签 | ||
en-US: Label | ||
--- | ||
|
||
## zh-CN | ||
|
||
使用 `label` 标签单独展示时间。 | ||
|
||
## en-US | ||
|
||
Use `label` show time alone. | ||
|
||
```jsx | ||
import { useState } from 'react'; | ||
import { Timeline, Radio } from 'antd'; | ||
|
||
function TimelimeLabelDemo() { | ||
const [mode, setMode] = useState('left'); | ||
|
||
const onChange = e => { | ||
setMode(e.target.value); | ||
}; | ||
|
||
return ( | ||
<> | ||
<Radio.Group | ||
onChange={onChange} | ||
value={mode} | ||
style={{ | ||
marginBottom: 20, | ||
}} | ||
> | ||
<Radio value="left">Left</Radio> | ||
<Radio value="right">Right</Radio> | ||
<Radio value="alternate">Alternate</Radio> | ||
</Radio.Group> | ||
<Timeline mode={mode}> | ||
<Timeline.Item label="2015-09-01">Create a services</Timeline.Item> | ||
<Timeline.Item label="2015-09-01 09:12:11">Solve initial network problems</Timeline.Item> | ||
<Timeline.Item>Technical testing</Timeline.Item> | ||
<Timeline.Item label="2015-09-01 09:12:11">Network problems being solved</Timeline.Item> | ||
</Timeline> | ||
</> | ||
); | ||
} | ||
|
||
ReactDOM.render(<TimelimeLabelDemo />, mountNode); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters