import React from "react"; import {X} from "@phosphor-icons/react"; import {useCurtains, useCurtain, useCallableCurtain} from "../Curtains/Curtains"; import {classes, Modify} from "../../Utils"; import {ModalType, ModalTypeIcon} from "./ModalsTypes"; /** * More natural name of useCurtains for modals. * @see useCurtains */ export const useModals = useCurtains; /** * More natural name of useCurtain for modals. * @see useCurtain */ export const useModal = useCurtain; /** * More natural name of useCallableCurtain for modals. * @see useCallableCurtain */ export const useCallableModal = useCallableCurtain; /** * Modal main component. */ export function Modal({className, title, closable, type, children, ...props}: React.PropsWithChildren, { /** * Modal title. */ title?: string; /** * Can disable close button. */ closable?: boolean; /** * Modal type. None by default. */ type?: ModalType; }>>) { // Modal is closable by default. closable = closable !== undefined ? closable : true; // Modal type is NONE by default. type = type !== undefined ? type : ModalType.NONE; // Modal state. const {close} = useModal(); return (

{ModalTypeIcon[type]} {title ?? ""}

{children}
); }