Refactor CacheSettingsComponent to use Box component

master
Tudor Stanciu 2024-03-25 02:53:42 +02:00
parent 79bd644f95
commit f29f159cc3
1 changed files with 6 additions and 8 deletions

View File

@ -1,32 +1,30 @@
import React from "react"; import React from "react";
import PropTypes from "prop-types"; import PropTypes from "prop-types";
import { Paper, Button } from "@mui/material"; import { Paper, Button, Box } from "@mui/material";
import { makeStyles } from "@mui/material/styles";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { PaperTitle } from "components/common"; import { PaperTitle } from "components/common";
import { usePermissions } from "hooks"; import { usePermissions } from "hooks";
const useStyles = makeStyles(theme => ({ const styles = {
content: { content: {
"& > *": { "& > *": {
margin: theme.spacing(1) margin: 1
} }
} }
})); };
const CacheSettingsComponent = ({ onResetCache }) => { const CacheSettingsComponent = ({ onResetCache }) => {
const classes = useStyles();
const { t } = useTranslation(); const { t } = useTranslation();
const { sysAdmin } = usePermissions(); const { sysAdmin } = usePermissions();
return ( return (
<Paper variant="outlined"> <Paper variant="outlined">
<PaperTitle text={t("Settings.Cache.Title")} /> <PaperTitle text={t("Settings.Cache.Title")} />
<div className={classes.content}> <Box sx={styles.content}>
<Button variant="outlined" color="secondary" disabled={!sysAdmin} onClick={onResetCache}> <Button variant="outlined" color="secondary" disabled={!sysAdmin} onClick={onResetCache}>
{t("Settings.Cache.Reset")} {t("Settings.Cache.Reset")}
</Button> </Button>
</div> </Box>
</Paper> </Paper>
); );
}; };