import * as React from "react"; import { Button, Header, Stack, Text } from "#gdq/index"; import { ButtonVariantColor } from "../Button/Button"; import { ModalRenderProps } from "./Modal"; import styles from "./ConfirmModal.module.css"; export interface ConfirmModalProps extends ModalRenderProps { title: React.ReactNode; body?: React.ReactNode; color?: ButtonVariantColor; confirmText?: React.ReactNode; cancelText?: React.ReactNode; onConfirm: () => unknown; onCancel?: () => unknown; } export function ConfirmModal(props: ConfirmModalProps) { const { title, body, color = "danger", confirmText = "Confirm", cancelText = "Cancel", onConfirm, onCancel, onClose, } = props; function handleConfirm() { onConfirm(); onClose(); } function handleCancel() { onCancel?.(); onClose(); } return (
{title}
{body != null ? {body} : null} {onCancel != null ? ( ) : null}
); }