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; | |