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.
56 lines
1.1 KiB
56 lines
1.1 KiB
import { makeStyles, withStyles } from '@material-ui/core/styles'; |
|
import { LinearProgress } from '@material-ui/core'; |
|
import { |
|
PURPLE_OFF, |
|
BLUE, |
|
PANEL_BACKGROUND, |
|
} from '../lib/consts/DEFAULT_THEME'; |
|
|
|
const completed = 100; |
|
|
|
const BorderLinearProgress = withStyles({ |
|
root: { |
|
height: 15, |
|
borderRadius: 2, |
|
}, |
|
colorPrimary: { |
|
backgroundColor: PANEL_BACKGROUND, |
|
}, |
|
bar: { |
|
borderRadius: 3, |
|
}, |
|
})(LinearProgress); |
|
|
|
const useStyles = makeStyles(() => ({ |
|
barOk: { |
|
backgroundColor: BLUE, |
|
}, |
|
barInProgress: { |
|
backgroundColor: PURPLE_OFF, |
|
}, |
|
})); |
|
|
|
const ProgressBar = ({ |
|
progressPercentage, |
|
}: { |
|
progressPercentage: number; |
|
}): JSX.Element => { |
|
const classes = useStyles(); |
|
return ( |
|
<> |
|
<BorderLinearProgress |
|
classes={{ |
|
bar: |
|
progressPercentage < completed |
|
? classes.barInProgress |
|
: classes.barOk, |
|
}} |
|
variant="determinate" |
|
value={progressPercentage} |
|
/> |
|
<LinearProgress variant="determinate" value={0} /> |
|
</> |
|
); |
|
}; |
|
|
|
export default ProgressBar;
|
|
|