feat : add progress bar

This commit is contained in:
GuillaumeSD
2024-03-08 23:56:29 +01:00
parent 91b56fde60
commit 81cbc2ca80
7 changed files with 72 additions and 27 deletions

View File

@@ -0,0 +1,39 @@
import {
Grid,
LinearProgress,
LinearProgressProps,
Typography,
} from "@mui/material";
const LinearProgressBar = (
props: LinearProgressProps & { value: number; label: string }
) => {
if (props.value === 0) return null;
return (
<Grid item container alignItems="center" justifyContent="center" xs={12}>
<Typography variant="caption" align="center">
{props.label}
</Typography>
<Grid
item
container
xs={12}
alignItems="center"
justifyContent="center"
wrap="nowrap"
>
<Grid item sx={{ width: "100%", mr: 2 }}>
<LinearProgress variant="determinate" {...props} />
</Grid>
<Grid item sx={{ minWidth: 35 }}>
<Typography variant="body2" color="text.secondary">{`${Math.round(
props.value
)}%`}</Typography>
</Grid>
</Grid>
</Grid>
);
};
export default LinearProgressBar;