forked from CITKParus/P8-Panels
60 lines
2.3 KiB
JavaScript
60 lines
2.3 KiB
JavaScript
/*
|
|
Парус 8 - Панели мониторинга
|
|
Компонент: Полноэкранный диалог
|
|
*/
|
|
|
|
//---------------------
|
|
//Подключение библиотек
|
|
//---------------------
|
|
|
|
import React from "react"; //Классы React
|
|
import PropTypes from "prop-types"; //Контроль свойств компонента
|
|
import { Dialog, AppBar, Toolbar, IconButton, Typography, Icon, DialogContent, DialogTitle } from "@mui/material"; //Интерфейсные компоненты
|
|
import { P8P_APP_BAR_VARIANT } from "../theme/variants/p8p_app_bar_variants"; //Варианты областей заголовка
|
|
import { P8P_TYPOGRAPHY_VARIANT } from "../theme/p8p_typography"; //Варианты шрифтов
|
|
import { P8P_COMPONENT_ZERO_PADDING } from "../theme/styles/common"; //Стили - общие
|
|
import { P8P_TYPOGRAPHY_DIALOG_TITLE } from "../theme/styles/typography"; //Стили текста
|
|
|
|
//-----------
|
|
//Тело модуля
|
|
//-----------
|
|
|
|
//Полноэкранный диалог
|
|
const P8PFullScreenDialog = ({ title, onClose, contentProps, children }) => {
|
|
const handleClose = () => {
|
|
onClose ? onClose() : null;
|
|
};
|
|
|
|
return (
|
|
<Dialog fullScreen open onClose={handleClose} scroll="paper" p={0}>
|
|
<DialogTitle sx={P8P_COMPONENT_ZERO_PADDING}>
|
|
<AppBar variant={P8P_APP_BAR_VARIANT.RELATIVE}>
|
|
<Toolbar>
|
|
<IconButton edge="start" color="inherit" onClick={handleClose} aria-label="close">
|
|
<Icon>close</Icon>
|
|
</IconButton>
|
|
<Typography variant={P8P_TYPOGRAPHY_VARIANT.H6} sx={P8P_TYPOGRAPHY_DIALOG_TITLE} component="div">
|
|
{title}
|
|
</Typography>
|
|
</Toolbar>
|
|
</AppBar>
|
|
</DialogTitle>
|
|
<DialogContent {...(contentProps ? contentProps : {})}>{children}</DialogContent>
|
|
</Dialog>
|
|
);
|
|
};
|
|
|
|
//Контроль свойств - Полноэкранный диалог
|
|
P8PFullScreenDialog.propTypes = {
|
|
title: PropTypes.string.isRequired,
|
|
onClose: PropTypes.func,
|
|
children: PropTypes.element,
|
|
contentProps: PropTypes.object
|
|
};
|
|
|
|
//----------------
|
|
//Интерфейс модуля
|
|
//----------------
|
|
|
|
export { P8PFullScreenDialog };
|