diff --git a/src/openforms/js/components/admin/form_design/useConfirm.stories.js b/src/openforms/js/components/admin/form_design/useConfirm.stories.js new file mode 100644 index 0000000000..e63a46e132 --- /dev/null +++ b/src/openforms/js/components/admin/form_design/useConfirm.stories.js @@ -0,0 +1,37 @@ +import {useState} from 'react'; + +import ActionButton from '../forms/ActionButton'; +import useConfirm from './useConfirm'; + +const ButtonWithUseConfirm = () => { + const [ConfirmationModal, confirm] = useConfirm( + 'A sample confirmation message', + 'The confirmation title' + ); + const [confirmationResult, setConfirmationResult] = useState(null); + return ( +
+ { + const result = await confirm(); + setConfirmationResult(result); + }} + /> + {confirmationResult !== null ? ( +

Confirmation result: {confirmationResult.toString()}

+ ) : null} + +
+ ); +}; + +export default { + title: 'Admin / Custom / UseConfirm', + render: () => , + component: useConfirm, +}; + +export const Default = { + name: 'Default', +};