mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-27 20:49:53 +08:00
demo: improve the use of Segmented (#51324)
This commit is contained in:
parent
cc85109fb1
commit
6e12a903c7
@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
import { Button, Flex, Segmented } from 'antd';
|
||||
import type { FlexProps, SegmentedProps } from 'antd';
|
||||
import type { FlexProps } from 'antd';
|
||||
|
||||
const boxStyle: React.CSSProperties = {
|
||||
width: '100%',
|
||||
@ -26,9 +26,9 @@ const App: React.FC = () => {
|
||||
return (
|
||||
<Flex gap="middle" align="start" vertical>
|
||||
<p>Select justify :</p>
|
||||
<Segmented options={justifyOptions} onChange={setJustify as SegmentedProps['onChange']} />
|
||||
<Segmented options={justifyOptions} onChange={setJustify} />
|
||||
<p>Select align :</p>
|
||||
<Segmented options={alignOptions} onChange={setAlignItems as SegmentedProps['onChange']} />
|
||||
<Segmented options={alignOptions} onChange={setAlignItems} />
|
||||
<Flex style={boxStyle} justify={justify} align={alignItems}>
|
||||
<Button type="primary">Primary</Button>
|
||||
<Button type="primary">Primary</Button>
|
||||
|
@ -34,7 +34,7 @@ const App: React.FC = () => {
|
||||
<ConfigProvider button={{ style: { width: buttonWidth, margin: 4 } }}>
|
||||
<Segmented
|
||||
options={['Show', 'Hide', 'Center']}
|
||||
onChange={(val: 'Show' | 'Hide' | 'Center') => setArrow(val)}
|
||||
onChange={setArrow}
|
||||
style={{ marginBottom: 24 }}
|
||||
/>
|
||||
<Flex vertical justify="center" align="center" className="demo">
|
||||
|
@ -32,10 +32,7 @@ const App: React.FC = () => {
|
||||
const [renderType, setRenderType] = React.useState<QRCodeProps['type']>('canvas');
|
||||
return (
|
||||
<Space id="myqrcode" direction="vertical">
|
||||
<Segmented
|
||||
options={['canvas', 'svg']}
|
||||
onChange={(val) => setRenderType(val as QRCodeProps['type'])}
|
||||
/>
|
||||
<Segmented options={['canvas', 'svg']} value={renderType} onChange={setRenderType} />
|
||||
<div>
|
||||
<QRCode
|
||||
type={renderType}
|
||||
|
@ -168,7 +168,7 @@ const App: React.FC = () => {
|
||||
/>
|
||||
<Segmented
|
||||
value={count}
|
||||
onChange={(value: number) => setCount(value)}
|
||||
onChange={setCount}
|
||||
options={[
|
||||
{ label: 'None', value: 0 },
|
||||
{ label: 'Less', value: 4 },
|
||||
|
@ -19,9 +19,9 @@ const App: React.FC = () => {
|
||||
return (
|
||||
<>
|
||||
<Segmented
|
||||
defaultValue="center"
|
||||
value={alignValue}
|
||||
style={{ marginBottom: 8 }}
|
||||
onChange={(value) => setAlignValue(value as Align)}
|
||||
onChange={setAlignValue}
|
||||
options={['start', 'center', 'end']}
|
||||
/>
|
||||
<Tabs
|
||||
|
@ -28,7 +28,7 @@ const App: React.FC = () => {
|
||||
<Segmented
|
||||
value={arrow}
|
||||
options={['Show', 'Hide', 'Center']}
|
||||
onChange={(val: 'Show' | 'Hide' | 'Center') => setArrow(val)}
|
||||
onChange={setArrow}
|
||||
style={{ marginBottom: 24 }}
|
||||
/>
|
||||
<Flex vertical justify="center" align="center" className="demo">
|
||||
|
Loading…
Reference in New Issue
Block a user