From f4a6e1c520c8bd4c0bb77751c5cc00267e52893a Mon Sep 17 00:00:00 2001 From: Josue Date: Wed, 14 Apr 2021 15:21:07 -0400 Subject: [PATCH] feat: add decorator to the Anvils component --- striker-ui/components/Anvils/AnvilList.tsx | 63 ++++++++++++++++++---- 1 file changed, 54 insertions(+), 9 deletions(-) diff --git a/striker-ui/components/Anvils/AnvilList.tsx b/striker-ui/components/Anvils/AnvilList.tsx index a6d3e08e..2bd34f52 100644 --- a/striker-ui/components/Anvils/AnvilList.tsx +++ b/striker-ui/components/Anvils/AnvilList.tsx @@ -1,7 +1,8 @@ import { makeStyles } from '@material-ui/core/styles'; -import { List, ListItem, ListItemText, Divider } from '@material-ui/core'; -import { TEXT } from '../../lib/consts/DEFAULT_THEME'; +import { ClassNameMap } from '@material-ui/styles'; +import { List, Box, Divider, ListItem } from '@material-ui/core'; import { BodyText } from '../Text'; +import { BLUE, PURPLE_OFF, RED_ON, TEXT } from '../../lib/consts/DEFAULT_THEME'; const useStyles = makeStyles(() => ({ root: { @@ -17,23 +18,67 @@ const useStyles = makeStyles(() => ({ '&:hover': { backgroundColor: '#F6F6E8', }, + paddingLeft: 0, + }, + anvil: { + paddingLeft: 0, + }, + decorator: { + width: '20px', + height: '100%', + borderRadius: 2, + }, + optimal: { + backgroundColor: BLUE, + }, + notReady: { + backgroundColor: PURPLE_OFF, + }, + degraded: { + backgroundColor: RED_ON, }, })); +const selectDecorator = ( + state: string, +): keyof ClassNameMap<'optimal' | 'notReady' | 'degraded'> => { + switch (state) { + case 'Optimal': + return 'optimal'; + case 'Not Ready': + return 'notReady'; + case 'Degraded': + return 'degraded'; + default: + return 'optimal'; + } +}; + const AnvilList = ({ list }: { list: AnvilListItem[] }): JSX.Element => { const classes = useStyles(); return ( - {list.map((anvil) => { return ( - - } - secondary={} - /> - + <> + + + + +
+ + + + + + + + ); })}