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.
42 lines
916 B
42 lines
916 B
import React, { useState } from 'react';
|
|
import { Button, Modal } from 'antd';
|
|
|
|
const App: React.FC = () => {
|
|
const [open, setOpen] = useState(false);
|
|
|
|
const showModal = () => {
|
|
setOpen(true);
|
|
};
|
|
|
|
const handleOk = (e: React.MouseEvent<HTMLElement>) => {
|
|
console.log(e);
|
|
setOpen(false);
|
|
};
|
|
|
|
const handleCancel = (e: React.MouseEvent<HTMLElement>) => {
|
|
console.log(e);
|
|
setOpen(false);
|
|
};
|
|
|
|
return (
|
|
<>
|
|
<Button type="primary" onClick={showModal}>
|
|
Open Modal with customized button props
|
|
</Button>
|
|
<Modal
|
|
title="Basic Modal"
|
|
open={open}
|
|
onOk={handleOk}
|
|
onCancel={handleCancel}
|
|
okButtonProps={{ disabled: true }}
|
|
cancelButtonProps={{ disabled: true }}
|
|
>
|
|
<p>Some contents...</p>
|
|
<p>Some contents...</p>
|
|
<p>Some contents...</p>
|
|
</Modal>
|
|
</>
|
|
);
|
|
};
|
|
|
|
export default App;
|
|
|