mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-15 17:19:11 +08:00
34 lines
739 B
TypeScript
34 lines
739 B
TypeScript
|
import React, { useState } from 'react';
|
||
|
import { Space, Switch } from 'antd';
|
||
|
|
||
|
const style: React.CSSProperties = {
|
||
|
width: 150,
|
||
|
height: 100,
|
||
|
background: 'red',
|
||
|
};
|
||
|
|
||
|
const App: React.FC = () => {
|
||
|
const [singleCol, setSingleCol] = useState(false);
|
||
|
|
||
|
return (
|
||
|
<>
|
||
|
<Switch
|
||
|
checked={singleCol}
|
||
|
onChange={() => {
|
||
|
setSingleCol(!singleCol);
|
||
|
}}
|
||
|
/>
|
||
|
<div style={{ boxShadow: '0 0 5px green' }}>
|
||
|
<Space style={{ width: singleCol ? 307 : 310, background: 'blue' }} size={[8, 8]} wrap>
|
||
|
<div style={style} />
|
||
|
<div style={style} />
|
||
|
<div style={style} />
|
||
|
<div style={style} />
|
||
|
</Space>
|
||
|
</div>
|
||
|
</>
|
||
|
);
|
||
|
};
|
||
|
|
||
|
export default App;
|