You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
1.1 KiB
57 lines
1.1 KiB
4 years ago
|
import { makeStyles, withStyles } from '@material-ui/core/styles';
|
||
4 years ago
|
import { LinearProgress } from '@material-ui/core';
|
||
4 years ago
|
import {
|
||
|
PURPLE_OFF,
|
||
4 years ago
|
BLUE,
|
||
4 years ago
|
PANEL_BACKGROUND,
|
||
4 years ago
|
} from '../../lib/consts/DEFAULT_THEME';
|
||
4 years ago
|
|
||
4 years ago
|
const completed = 100;
|
||
|
|
||
4 years ago
|
const BorderLinearProgress = withStyles({
|
||
|
root: {
|
||
4 years ago
|
height: 15,
|
||
|
borderRadius: 2,
|
||
4 years ago
|
},
|
||
|
colorPrimary: {
|
||
|
backgroundColor: PANEL_BACKGROUND,
|
||
|
},
|
||
|
bar: {
|
||
|
borderRadius: 3,
|
||
|
},
|
||
|
})(LinearProgress);
|
||
|
|
||
4 years ago
|
const useStyles = makeStyles(() => ({
|
||
|
barOk: {
|
||
|
backgroundColor: BLUE,
|
||
4 years ago
|
},
|
||
4 years ago
|
barInProgress: {
|
||
|
backgroundColor: PURPLE_OFF,
|
||
4 years ago
|
},
|
||
|
}));
|
||
|
|
||
4 years ago
|
const ProgressBar = ({
|
||
|
progressPercentage,
|
||
|
}: {
|
||
|
progressPercentage: number;
|
||
|
}): JSX.Element => {
|
||
4 years ago
|
const classes = useStyles();
|
||
|
return (
|
||
4 years ago
|
<>
|
||
|
<BorderLinearProgress
|
||
|
classes={{
|
||
|
bar:
|
||
|
progressPercentage < completed
|
||
|
? classes.barInProgress
|
||
|
: classes.barOk,
|
||
|
}}
|
||
|
variant="determinate"
|
||
|
value={progressPercentage}
|
||
|
/>
|
||
4 years ago
|
<LinearProgress variant="determinate" value={0} />
|
||
4 years ago
|
</>
|
||
4 years ago
|
);
|
||
|
};
|
||
|
|
||
|
export default ProgressBar;
|