Refactor common components

master
Tudor Stanciu 2024-03-25 02:37:54 +02:00
parent 33d61de6d3
commit 799d95ab23
2 changed files with 14 additions and 15 deletions

View File

@ -10,7 +10,7 @@ const NotAllowed = () => {
sx={{ sx={{
width: "100%", width: "100%",
"& > * + *": { "& > * + *": {
marginTop: 1 // theme.spacing(1) marginTop: 1
} }
}} }}
> >

View File

@ -1,14 +1,13 @@
import React from "react"; import React from "react";
import PropTypes from "prop-types"; import PropTypes from "prop-types";
import { makeStyles } from "@mui/material/styles"; import { Typography, Box } from "@mui/material";
import { Typography } from "@mui/material";
const useStyles = makeStyles(theme => ({ const styles = {
box: { box: {
display: "flex", display: "flex",
justifyContent: "space-between", justifyContent: "space-between",
marginBottom: theme.spacing(1), marginBottom: 1,
marginTop: theme.spacing(0) marginTop: 0
}, },
title: { title: {
display: "flex", display: "flex",
@ -16,22 +15,22 @@ const useStyles = makeStyles(theme => ({
flexDirection: "column", flexDirection: "column",
minHeight: "40px" minHeight: "40px"
}, },
titleText: { textTransform: "uppercase" } titleText: {
})); textTransform: "uppercase"
}
};
const PageTitle = ({ text, toolBar, navigation }) => { const PageTitle = ({ text, toolBar, navigation }) => {
const classes = useStyles();
return ( return (
<div className={classes.box}> <Box sx={styles.box}>
{navigation && navigation} {navigation && navigation}
<div className={classes.title}> <Box sx={styles.title}>
<Typography className={classes.titleText} variant="h3" size="sm"> <Typography sx={styles.titleText} variant="h3" size="sm">
{text} {text}
</Typography> </Typography>
</div> </Box>
{toolBar && toolBar} {toolBar && toolBar}
</div> </Box>
); );
}; };