mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-15 17:19:11 +08:00
751bf40f60
* feat: update timeline to data driven
50 lines
1.1 KiB
TypeScript
50 lines
1.1 KiB
TypeScript
import React, { useState } from 'react';
|
|
import type { RadioChangeEvent } from 'antd';
|
|
import { Radio, Timeline } from 'antd';
|
|
|
|
const App: React.FC = () => {
|
|
const [mode, setMode] = useState<'left' | 'alternate' | 'right'>('left');
|
|
|
|
const onChange = (e: RadioChangeEvent) => {
|
|
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}
|
|
items={[
|
|
{
|
|
label: '2015-09-01',
|
|
children: 'Create a services',
|
|
},
|
|
{
|
|
label: '2015-09-01 09:12:11',
|
|
children: 'Solve initial network problems',
|
|
},
|
|
{
|
|
children: 'Technical testing',
|
|
},
|
|
{
|
|
label: '2015-09-01 09:12:11',
|
|
children: 'Network problems being solved',
|
|
},
|
|
]}
|
|
/>
|
|
</>
|
|
);
|
|
};
|
|
|
|
export default App;
|