♻️ refactor(Page): improve title spacing on mobile

This commit is contained in:
2024-02-15 17:09:11 +01:00
parent 6271aaf095
commit ddd1d80554
+28 -21
View File
@@ -1,5 +1,5 @@
import React from 'react' import React from 'react'
import { Box, BoxProps, Container, Typography } from '@mui/material' import { Box, BoxProps, Container, Divider, Typography } from '@mui/material'
import { Footer, Toobar } from 'components/molecules' import { Footer, Toobar } from 'components/molecules'
@@ -17,6 +17,32 @@ const Page: React.FC<BoxProps> = ({ title, children, ...props }) => {
return ( return (
<Box sx={{ flexGrow: 1 }} aria-label="page"> <Box sx={{ flexGrow: 1 }} aria-label="page">
<Toobar /> <Toobar />
{title && (
<>
<Typography
variant="h2"
aria-label="page-title"
textAlign="center"
sx={{
mt: 6,
p: 6,
}}>
{title}
</Typography>
<Divider
variant="middle"
sx={{
borderColor: 'primary.main',
borderStyle: 'solid',
borderWidth: 2,
mx: 'auto',
mb: 4,
width: '30em',
maxWidth: 'calc(60% - 2.5em)',
}}
/>
</>
)}
<Container <Container
component="main" component="main"
maxWidth={false} maxWidth={false}
@@ -30,26 +56,7 @@ const Page: React.FC<BoxProps> = ({ title, children, ...props }) => {
...props.sx, ...props.sx,
}}> }}>
{/* Children is included in props */} {/* Children is included in props */}
{title && (
<>
<Typography
variant="h2"
aria-label="page-title"
sx={{
textAlign: 'center',
borderColor: 'primary.main',
borderBottomStyle: 'solid',
borderBottomWidth: 2,
mx: 'auto',
mt: 6,
mb: 4,
p: 6,
width: '60%',
}}>
{title}
</Typography>
</>
)}
{children} {children}
</Container> </Container>
<Footer /> <Footer />