/
MqStatus.tsx
41 lines (36 loc) · 1007 Bytes
/
MqStatus.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
// SPDX-License-Identifier: Apache-2.0
import { theme } from '../../../helpers/theme'
import Box from '@material-ui/core/Box'
import MqText from '../text/MqText'
import React from 'react'
import createStyles from '@material-ui/core/styles/createStyles'
import withStyles, { WithStyles } from '@material-ui/core/styles/withStyles'
const styles = () =>
createStyles({
type: {
display: 'flex',
alignItems: 'center',
gap: theme.spacing(1)
},
status: {
width: theme.spacing(2),
height: theme.spacing(2),
borderRadius: '50%'
}
})
interface OwnProps {
color: string | null
label?: string
}
const MqStatus: React.FC<OwnProps & WithStyles<typeof styles>> = ({ label, color, classes }) => {
if (!color) {
return null
}
return (
<Box className={classes.type}>
<Box className={classes.status} style={{ backgroundColor: color }} />
{label && <MqText>{label}</MqText>}
</Box>
)
}
export default withStyles(styles)(MqStatus)