diff --git a/apps/client/src/common/components/dialog/Dialog.module.scss b/apps/client/src/common/components/dialog/Dialog.module.scss new file mode 100644 index 000000000..c5599bb93 --- /dev/null +++ b/apps/client/src/common/components/dialog/Dialog.module.scss @@ -0,0 +1,43 @@ +.dialog { + position: fixed; + top: 10%; + left: 50%; + + z-index: $zindex-dialog; + transform: translateX(-50%); + + padding-inline: 1rem; + min-width: min(420px, 90vw); + + background-color: $gray-1250; + color: $ui-white; + border-radius: 3px; + box-shadow: $box-shadow-l1; + border: 1px solid $gray-1200; +} + +.title { + font-size: 1.25rem; + padding-block: 1rem; + + display: flex; + align-items: center; + justify-content: space-between; +} + +.body { + display: flex; + flex-direction: column; + gap: 0.5rem; + + max-height: min(80vh, 600px); + overflow-y: auto; +} + +.footer { + padding-block: 1rem; + display: flex; + align-items: center; + justify-content: end; + gap: 1rem; +} diff --git a/apps/client/src/common/components/dialog/Dialog.tsx b/apps/client/src/common/components/dialog/Dialog.tsx new file mode 100644 index 000000000..ed630372d --- /dev/null +++ b/apps/client/src/common/components/dialog/Dialog.tsx @@ -0,0 +1,42 @@ +import type { ReactNode } from 'react'; +import { IoClose } from 'react-icons/io5'; +import { Dialog as BaseDialog } from '@base-ui-components/react/dialog'; + +import IconButton from '../buttons/IconButton'; + +import style from './Dialog.module.scss'; + +interface DialogProps { + isOpen: boolean; + title: string; + showCloseButton?: boolean; + bodyElements: ReactNode; + footerElements: ReactNode; + onClose: () => void; +} + +export default function Dialog({ isOpen, title, showCloseButton, bodyElements, footerElements, onClose }: DialogProps) { + return ( + { + if (!isOpen) onClose(); + }} + > + + +
+ {title} + {showCloseButton && ( + + + + )} +
+
{bodyElements}
+
{footerElements}
+
+
+
+ ); +}