-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
/
CustomizedProgressBars.tsx
100 lines (91 loc) · 2.1 KB
/
CustomizedProgressBars.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
import React from 'react';
import { lighten, makeStyles, createStyles, withStyles, Theme } from '@material-ui/core/styles';
import CircularProgress, { CircularProgressProps } from '@material-ui/core/CircularProgress';
import LinearProgress from '@material-ui/core/LinearProgress';
const ColorCircularProgress = withStyles({
root: {
color: '#00695c',
},
})(CircularProgress);
const ColorLinearProgress = withStyles({
colorPrimary: {
backgroundColor: '#b2dfdb',
},
barColorPrimary: {
backgroundColor: '#00695c',
},
})(LinearProgress);
const BorderLinearProgress = withStyles({
root: {
height: 10,
backgroundColor: lighten('#ff6c5c', 0.5),
},
bar: {
borderRadius: 20,
backgroundColor: '#ff6c5c',
},
})(LinearProgress);
// Inspired by the Facebook spinners.
const useStylesFacebook = makeStyles({
root: {
position: 'relative',
},
top: {
color: '#eef3fd',
},
bottom: {
color: '#6798e5',
animationDuration: '550ms',
position: 'absolute',
left: 0,
},
});
function FacebookProgress(props: CircularProgressProps) {
const classes = useStylesFacebook();
return (
<div className={classes.root}>
<CircularProgress
variant="determinate"
value={100}
className={classes.top}
size={24}
thickness={4}
{...props}
/>
<CircularProgress
variant="indeterminate"
disableShrink
className={classes.bottom}
size={24}
thickness={4}
{...props}
/>
</div>
);
}
const useStyles = makeStyles((theme: Theme) =>
createStyles({
root: {
flexGrow: 1,
},
margin: {
margin: theme.spacing(1),
},
}),
);
export default function CustomizedProgressBars() {
const classes = useStyles();
return (
<div className={classes.root}>
<ColorCircularProgress size={30} thickness={5} />
<ColorLinearProgress className={classes.margin} />
<BorderLinearProgress
className={classes.margin}
variant="determinate"
color="secondary"
value={50}
/>
<FacebookProgress />
</div>
);
}