anvil/striker-ui/components/Decorator.tsx

38 lines
722 B
TypeScript
Raw Normal View History

2021-04-30 16:42:52 +00:00
import { makeStyles } from '@material-ui/core/styles';
import {
BLUE,
GREY,
PURPLE,
RED,
BORDER_RADIUS,
} from '../lib/consts/DEFAULT_THEME';
2021-04-30 16:42:52 +00:00
export type Colours = 'ok' | 'off' | 'error' | 'warning';
const useStyles = makeStyles(() => ({
decorator: {
2021-04-30 17:39:28 +00:00
width: '1.4em',
2021-04-30 16:42:52 +00:00
height: '100%',
borderRadius: BORDER_RADIUS,
2021-04-30 16:42:52 +00:00
},
ok: {
backgroundColor: BLUE,
},
warning: {
backgroundColor: PURPLE,
2021-04-30 16:42:52 +00:00
},
error: {
backgroundColor: RED,
2021-04-30 16:42:52 +00:00
},
off: {
backgroundColor: GREY,
},
}));
const Decorator = ({ colour }: { colour: Colours }): JSX.Element => {
const classes = useStyles();
return <div className={`${classes.decorator} ${classes[colour]}`} />;
};
export default Decorator;