LFFE-25 Implementation of print layout and Printable Page

This commit is contained in:
AmirHossein Mahmoodi
2023-11-13 13:47:00 +03:30
parent 2a7707152e
commit 8355a781bb
3 changed files with 64 additions and 2 deletions

View File

@@ -1,5 +1,5 @@
import MenuIcon from "@mui/icons-material/Menu";
import {AppBar, Box, Container, CssBaseline, IconButton, Stack, Toolbar, useTheme} from "@mui/material";
import {AppBar, Box, Container, IconButton, Stack, Toolbar, useTheme} from "@mui/material";
import ProfileMenu from "./ProfileMenu";
function Header({drawerWidth, handleDrawerToggle}) {
@@ -7,7 +7,6 @@ function Header({drawerWidth, handleDrawerToggle}) {
return (
<>
<CssBaseline/>
<AppBar
position="fixed"
sx={{

View File

@@ -0,0 +1,47 @@
import {AppBar, Button, Container, Stack, Toolbar, useTheme} from "@mui/material";
import {useTranslations} from "next-intl";
import {useRouter} from "next/router";
function Header({drawerWidth, handleDrawerToggle}) {
const theme = useTheme();
const t = useTranslations()
const router = useRouter()
return (
<AppBar
position="fixed"
sx={{
width: '100%',
displayPrint: 'none'
}}
>
<Container maxWidth="xxl">
<Toolbar
disableGutters
sx={{
display: "flex",
}}
>
<Stack
direction="row"
sx={{
flex: 1,
position: "relative",
...theme.mixins.toolbar,
}}
>
<Button onClick={() => router.back()} size={'large'} sx={{
color: "inherit",
}}>{t('button_back_to_previous')}</Button>
</Stack>
<Stack direction="row" spacing={4} justifyContent="flex-end" sx={{flex: 1}}>
<Button onClick={() => print()} size={'large'} variant={'contained'}
color={'secondary'}>{t('btn_print')}</Button>
</Stack>
</Toolbar>
</Container>
</AppBar>
);
}
export default Header;

View File

@@ -0,0 +1,16 @@
import Header from "@/components/layouts/Print/Header";
import {Paper, Toolbar} from "@mui/material";
const Print = (props) => {
return (
<>
<Header/>
<Toolbar sx={{displayPrint: 'none'}}/>
<Paper elevation={0} sx={{width: '100%', bgcolor: '#efefef'}}>
{props.children}
</Paper>
</>
)
}
export default Print