import { FocusVisibleButton } from "@/new/photos/components/FocusVisibleButton"; import { Breakpoint, DialogActions, DialogContent, DialogProps, Typography, } from "@mui/material"; import { t } from "i18next"; import React from "react"; import DialogIcon from "./DialogIcon"; import DialogTitleWithCloseButton, { dialogCloseHandler, } from "./TitleWithCloseButton"; import DialogBoxBase from "./base"; import { DialogBoxAttributes } from "./types"; type IProps = React.PropsWithChildren< Omit & { onClose: () => void; attributes: DialogBoxAttributes; size?: Breakpoint; titleCloseButton?: boolean; } >; export default function DialogBox({ attributes, children, open, size, onClose, titleCloseButton, ...props }: IProps) { if (!attributes) { return <>; } const handleClose = dialogCloseHandler({ staticBackdrop: attributes.staticBackdrop, nonClosable: attributes.nonClosable, onClose: onClose, }); return ( {attributes.icon && } {attributes.title && ( {attributes.title} )} {(children || attributes?.content) && ( {children || ( {attributes.content} )} )} {(attributes.close || attributes.proceed) && ( <> {attributes.close && ( { attributes.close.action && attributes.close?.action(); onClose(); }} > {attributes.close?.text ?? t("OK")} )} {attributes.proceed && ( { attributes.proceed.action(); onClose(); }} disabled={attributes.proceed.disabled} autoFocus={attributes.proceed?.autoFocus} > {attributes.proceed.text} )} {attributes.secondary && ( { attributes.secondary.action(); onClose(); }} disabled={attributes.secondary.disabled} > {attributes.secondary.text} )} )} ); }