-
Notifications
You must be signed in to change notification settings - Fork 37
/
index.jsx
68 lines (60 loc) · 1.59 KB
/
index.jsx
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
import React from 'react'
import PropTypes from 'prop-types'
import { withStyles } from '../styles'
import Banner from '../Banner'
import { LinearProgress } from '../Progress'
import Typography from '../Typography'
const progressHeight = '0.125rem'
const styles = theme => ({
banner: {
backgroundColor: theme.palette.background.default
},
progress: {
backgroundColor: 'transparent',
height: progressHeight,
marginTop: `-${progressHeight}`
}
})
const ProgressionBanner = withStyles(styles)(
({ classes, value, text, icon, button, progressBar }) => {
const variant = value ? 'determinate' : undefined
return (
<>
<Banner
className={classes.banner}
icon={icon}
text={
<Typography component="span" variant="h6">
{text}
</Typography>
}
buttonOne={button}
inline
/>
{progressBar && (
<LinearProgress
className={classes.progress}
variant={variant}
value={value}
/>
)}
</>
)
}
)
ProgressionBanner.propTypes = {
/** Percentage of progression, should be between 0 and 100 */
value: PropTypes.number,
/** Text to be shown in the banner */
text: PropTypes.string,
/** Icon to be shown in the banner */
icon: PropTypes.node,
/** Button to use in the banner */
button: PropTypes.node,
/** Progression bar is hidden if set to false (defaults to true) */
progressBar: PropTypes.bool
}
ProgressionBanner.defaultProps = {
progressBar: true
}
export default ProgressionBanner