mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-13 15:49:10 +08:00
502dac12aa
* docs: fix code * feat: lint * feat: prettier * feat: test * feat: review * feat: format html * feat: format html
23 lines
592 B
TypeScript
23 lines
592 B
TypeScript
import React, { useState } from 'react';
|
|
import { Alert, Space, Switch } from 'antd';
|
|
|
|
const App: React.FC = () => {
|
|
const [visible, setVisible] = useState(true);
|
|
|
|
const handleClose = () => {
|
|
setVisible(false);
|
|
};
|
|
|
|
return (
|
|
<Space direction="vertical" style={{ width: '100%' }}>
|
|
{visible && (
|
|
<Alert message="Alert Message Text" type="success" closable afterClose={handleClose} />
|
|
)}
|
|
<p>click the close button to see the effect</p>
|
|
<Switch onChange={setVisible} checked={visible} disabled={visible} />
|
|
</Space>
|
|
);
|
|
};
|
|
|
|
export default App;
|