From aa79943db5702e57cf977d5b8f225db82bcf3d14 Mon Sep 17 00:00:00 2001 From: Nate Kelley Date: Thu, 13 Mar 2025 11:39:40 -0600 Subject: [PATCH] confirm modal update --- .../ui/modal/ConfirmModal.stories.tsx | 57 +++++++++++++++++++ web/src/components/ui/modal/ModalBase.tsx | 2 +- .../ChatLayoutContext/ChatLayoutContext.tsx | 2 - .../useSelectedFileAndLayout.ts | 2 - 4 files changed, 58 insertions(+), 5 deletions(-) create mode 100644 web/src/components/ui/modal/ConfirmModal.stories.tsx diff --git a/web/src/components/ui/modal/ConfirmModal.stories.tsx b/web/src/components/ui/modal/ConfirmModal.stories.tsx new file mode 100644 index 000000000..263abb85d --- /dev/null +++ b/web/src/components/ui/modal/ConfirmModal.stories.tsx @@ -0,0 +1,57 @@ +import type { Meta, StoryObj } from '@storybook/react'; +import { ConfirmModal, ConfirmProps } from './ConfirmModal'; +import { Button } from '../buttons/Button'; +import React from 'react'; +import { fn } from '@storybook/test'; +import { useBusterNotifications } from '../../../context/BusterNotifications'; + +const meta: Meta = { + title: 'UI/Modal/ConfirmModal', + component: ConfirmModal +}; + +export default meta; +type Story = StoryObj; + +export const Default: Story = { + render: () => { + const { openConfirmModal } = useBusterNotifications(); + + const props: ConfirmProps = { + title: 'Confirm', + content: 'Are you sure you want to confirm this action?', + onOk: async () => { + await new Promise((resolve) => setTimeout(resolve, 1)); + alert('onOk'); + }, + onCancel: async () => { + await new Promise((resolve) => setTimeout(resolve, 1)); + alert('onCancel'); + } + }; + + return ( +
+ + +
+ ); + } +}; diff --git a/web/src/components/ui/modal/ModalBase.tsx b/web/src/components/ui/modal/ModalBase.tsx index 65e9535d8..d9f38957c 100644 --- a/web/src/components/ui/modal/ModalBase.tsx +++ b/web/src/components/ui/modal/ModalBase.tsx @@ -50,7 +50,7 @@ const DialogContent = React.memo(