UNPKG

@craftercms/studio-ui

Version:

Services, components, models & utils to build CrafterCMS authoring extensions.

103 lines (101 loc) 3.62 kB
/* * Copyright (C) 2007-2022 Crafter Software Corporation. All Rights Reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as published by * the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* * Copyright (C) 2007-2023 Crafter Software Corporation. All Rights Reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as published by * the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ import * as React from 'react'; import questionGraphicUrl from '../../assets/question.svg'; import useUnmount from '../../hooks/useUnmount'; import DialogContent from '@mui/material/DialogContent'; import Typography from '@mui/material/Typography'; import DialogContentText from '@mui/material/DialogContentText'; import Box from '@mui/material/Box'; import { DialogFooter } from '../DialogFooter'; import { nnou } from '../../utils/object'; export function AlertDialogContainer(props) { const { onClosed, body, title, children, imageUrl = questionGraphicUrl, buttons, sxs } = props; useUnmount(onClosed); return React.createElement( React.Fragment, null, React.createElement( DialogContent, { id: 'alertDialogBody', sx: Object.assign( { textAlign: 'center', padding: '40px 20px 25px !important' }, sxs === null || sxs === void 0 ? void 0 : sxs.body ) }, imageUrl && React.createElement(Box, { component: 'img', src: imageUrl, alt: '', sx: Object.assign( { margin: 'auto', display: 'block', paddingBottom: '35px' }, sxs === null || sxs === void 0 ? void 0 : sxs.image ) }), title && React.createElement( Typography, { variant: 'body1', component: 'h2', sx: Object.assign({ paddingBottom: '5px' }, sxs === null || sxs === void 0 ? void 0 : sxs.title) }, title ), body && React.createElement(DialogContentText, { color: 'textPrimary', variant: 'body2' }, body), children ), nnou(buttons) && React.createElement( DialogFooter, { sx: Object.assign( { borderTop: 'none', display: 'flex', flexDirection: 'column', padding: '0 40px 35px', backgroundColor: null, '& > :not(:first-child)': { marginTop: '10px', marginLeft: 0 } }, sxs === null || sxs === void 0 ? void 0 : sxs.footer ) }, buttons ) ); } export default AlertDialogContainer;