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.
47 lines
950 B
47 lines
950 B
import { styled } from '@mui/material'; |
|
|
|
import { PURPLE, BLUE } from '../../lib/consts/DEFAULT_THEME'; |
|
|
|
import BorderLinearProgress from './BorderLinearProgress'; |
|
import Underline from './Underline'; |
|
|
|
const PREFIX = 'ProgressBar'; |
|
|
|
const classes = { |
|
barOk: `${PREFIX}-barOk`, |
|
barInProgress: `${PREFIX}-barInProgress`, |
|
}; |
|
|
|
const StyledDiv = styled('div')(() => ({ |
|
[`& .${classes.barOk}`]: { |
|
backgroundColor: BLUE, |
|
}, |
|
|
|
[`& .${classes.barInProgress}`]: { |
|
backgroundColor: PURPLE, |
|
}, |
|
})); |
|
|
|
const completed = 100; |
|
|
|
const ProgressBar = ({ |
|
progressPercentage, |
|
}: { |
|
progressPercentage: number; |
|
}): JSX.Element => ( |
|
<StyledDiv> |
|
<BorderLinearProgress |
|
classes={{ |
|
bar: |
|
progressPercentage < completed |
|
? classes.barInProgress |
|
: classes.barOk, |
|
}} |
|
variant="determinate" |
|
value={progressPercentage} |
|
/> |
|
<Underline /> |
|
</StyledDiv> |
|
); |
|
|
|
export default ProgressBar;
|
|
|