docs: segmented update (#35171)

* docs: segmented update

* test: fix lint
This commit is contained in:
MadCcc 2022-04-22 12:26:44 +08:00 committed by GitHub
parent 91a7e8ba63
commit 3511642337
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 14 additions and 22 deletions

View File

@ -16,10 +16,7 @@ The most basic usage.
```jsx
import { Segmented } from 'antd';
ReactDOM.render(
<Segmented options={['Daily', 'Weekly', 'Monthly', 'Quarterly', 'Yearly']} />,
mountNode,
);
export default () => <Segmented options={['Daily', 'Weekly', 'Monthly', 'Quarterly', 'Yearly']} />;
```
```css

View File

@ -16,8 +16,7 @@ title:
```jsx
import { Segmented } from 'antd';
ReactDOM.render(
<Segmented block options={[123, 456, 'longtext-longtext-longtext-longtext']} />,
mountNode,
export default () => (
<Segmented block options={[123, 456, 'longtext-longtext-longtext-longtext']} />
);
```

View File

@ -13,12 +13,12 @@ title:
Controlled Segmented.
```jsx
```tsx
import React, { useState } from 'react';
import { Segmented } from 'antd';
const Demo: React.FC = () => {
const [value, setValue] = useState('Map');
const [value, setValue] = useState<string | number>('Map');
return (
<Segmented
@ -29,5 +29,5 @@ const Demo: React.FC = () => {
);
};
ReactDOM.render(<Demo />, mountNode);
export default Demo;
```

View File

@ -17,7 +17,7 @@ Custom each Segmented Item by ReactNode.
import { Avatar, Segmented } from 'antd';
import { UserOutlined } from '@ant-design/icons';
ReactDOM.render(
export default () => (
<>
<Segmented
options={[
@ -91,7 +91,6 @@ ReactDOM.render(
},
]}
/>
</>,
mountNode,
</>
);
```

View File

@ -16,7 +16,7 @@ Disabled Segmented.
```jsx
import { Segmented } from 'antd';
ReactDOM.render(
export default () => (
<>
<Segmented options={['Map', 'Transit', 'Satellite']} disabled />
<br />
@ -29,7 +29,6 @@ ReactDOM.render(
'Yearly',
]}
/>
</>,
mountNode,
</>
);
```

View File

@ -16,14 +16,13 @@ There are three sizes of an Segmented: `large` (40px), `default` (32px) and `sma
```jsx
import { Segmented } from 'antd';
ReactDOM.render(
export default () => (
<>
<Segmented size="large" options={['Daily', 'Weekly', 'Monthly', 'Quarterly', 'Yearly']} />
<br />
<Segmented options={['Daily', 'Weekly', 'Monthly', 'Quarterly', 'Yearly']} />
<br />
<Segmented size="small" options={['Daily', 'Weekly', 'Monthly', 'Quarterly', 'Yearly']} />
</>,
mountNode,
</>
);
```

View File

@ -17,7 +17,7 @@ Set `icon` for Segmented Item.
import { Segmented } from 'antd';
import { AppstoreOutlined, BarsOutlined } from '@ant-design/icons';
ReactDOM.render(
export default () => (
<Segmented
options={[
{
@ -31,7 +31,6 @@ ReactDOM.render(
icon: <AppstoreOutlined />,
},
]}
/>,
mountNode,
/>
);
```