Skip to content

Commit

Permalink
Update declarative example
Browse files Browse the repository at this point in the history
  • Loading branch information
supnate committed Oct 1, 2023
1 parent 162e8a4 commit ad0e0fd
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions example/src/Declarative.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
import { Modal, Button } from 'antd';
import NiceModal, { useModal, ModalDef } from '@ebay/nice-modal-react';
import NiceModal, { useModal } from '@ebay/nice-modal-react';

export const MyAntdModal = NiceModal.create(({ name }) => {
const modal = useModal();
return (
<Modal title="Hello Antd" visible={modal.visible} onOk={modal.hide} onCancel={modal.hide} afterClose={modal.remove}>
<Modal
title="Hello Antd"
visible={modal.visible}
onOk={modal.hide}
onCancel={modal.hide}
afterClose={modal.remove}
>
Greetings: {name}!
</Modal>
);
Expand All @@ -16,7 +22,7 @@ export default function AntdSample() {
<Button type="primary" onClick={() => NiceModal.show('my-antd-modal', { name: 'Nate' })}>
Show Modal
</Button>
<ModalDef id="my-antd-modal" component={MyAntdModal} />
<MyAntdModal id="my-antd-modal" />
</>
);
}

0 comments on commit ad0e0fd

Please sign in to comment.