import React, { FunctionComponent } from "react"; import { useOverlayContext } from "../../../../common/context/OverlayContext"; import { Button } from "../../Button"; import { IconSuccess, IconWarning } from "../../Icon"; import { useLockBodyScroll } from "../../../../common/hooks/useLockBodyScroll"; export const enum MESSAGE_TYPE { SUCCESS = "success", WARNING = "warning", NONE = "none", } export interface ConfirmationContentProps { messageType: MESSAGE_TYPE; title?: string; children?: React.ReactNode; btnText?: string; maxHeight?: number; className?: string; } export const DismissalButton: FunctionComponent<{ buttonText?: string }> = ({ buttonText = "Dismiss", }: { buttonText?: string; }) => { const { closeOverlay } = useOverlayContext(); return ( ); }; export const ConfirmationContent: FunctionComponent< ConfirmationContentProps > = ({ messageType, title: messageTitle, children, maxHeight, className, ...props }: ConfirmationContentProps) => { useLockBodyScroll(); const style = { ...(maxHeight && { maxHeight: `${maxHeight}px` }), }; let messageIcon; switch (messageType) { case MESSAGE_TYPE.SUCCESS: messageIcon = ; break; case MESSAGE_TYPE.WARNING: messageIcon = ; break; default: messageIcon = null; break; } return (
{messageIcon &&
{messageIcon}
}

{messageTitle}

{children}
); };