You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.1 KiB
44 lines
1.1 KiB
import React, { useState } from 'react';
|
|
import { Button, Modal } from 'antd';
|
|
|
|
const App: React.FC = () => {
|
|
const [modal1Open, setModal1Open] = useState(false);
|
|
const [modal2Open, setModal2Open] = useState(false);
|
|
|
|
return (
|
|
<>
|
|
<Button type="primary" onClick={() => setModal1Open(true)}>
|
|
Display a modal dialog at 20px to Top
|
|
</Button>
|
|
<Modal
|
|
title="20px to Top"
|
|
style={{ top: 20 }}
|
|
open={modal1Open}
|
|
onOk={() => setModal1Open(false)}
|
|
onCancel={() => setModal1Open(false)}
|
|
>
|
|
<p>some contents...</p>
|
|
<p>some contents...</p>
|
|
<p>some contents...</p>
|
|
</Modal>
|
|
<br />
|
|
<br />
|
|
<Button type="primary" onClick={() => setModal2Open(true)}>
|
|
Vertically centered modal dialog
|
|
</Button>
|
|
<Modal
|
|
title="Vertically centered modal dialog"
|
|
centered
|
|
open={modal2Open}
|
|
onOk={() => setModal2Open(false)}
|
|
onCancel={() => setModal2Open(false)}
|
|
>
|
|
<p>some contents...</p>
|
|
<p>some contents...</p>
|
|
<p>some contents...</p>
|
|
</Modal>
|
|
</>
|
|
);
|
|
};
|
|
|
|
export default App;
|
|
|