From cd3773f7e043b1c1a4b7f25da75debe616fe6bde Mon Sep 17 00:00:00 2001 From: Josue Date: Wed, 23 Jun 2021 16:26:24 -0400 Subject: [PATCH] style: fix colours when enabling edit mode --- striker-ui/components/Servers.tsx | 75 ++++++++++++++++++++++--------- 1 file changed, 54 insertions(+), 21 deletions(-) diff --git a/striker-ui/components/Servers.tsx b/striker-ui/components/Servers.tsx index abac519a..530bd617 100644 --- a/striker-ui/components/Servers.tsx +++ b/striker-ui/components/Servers.tsx @@ -4,10 +4,12 @@ import { ListItem, Divider, Box, + IconButton, Button, Checkbox, Menu, MenuItem, + Typography, } from '@material-ui/core'; import EditIcon from '@material-ui/icons/Edit'; import MoreVertIcon from '@material-ui/icons/MoreVert'; @@ -15,7 +17,14 @@ import { makeStyles } from '@material-ui/core/styles'; import { Panel } from './Panels'; import PeriodicFetch from '../lib/fetchers/periodicFetch'; import { HeaderText, BodyText } from './Text'; -import { HOVER, DIVIDER } from '../lib/consts/DEFAULT_THEME'; +import { + HOVER, + DIVIDER, + TEXT, + BLUE, + RED, + GREY, +} from '../lib/consts/DEFAULT_THEME'; import { AnvilContext } from './AnvilContext'; import serverState from '../lib/consts/SERVERS'; import Decorator, { Colours } from './Decorator'; @@ -57,6 +66,13 @@ const useStyles = makeStyles((theme) => ({ checkbox: { paddingTop: '.8em', }, + editButton: { + borderRadius: 8, + backgroundColor: GREY, + '&:hover': { + backgroundColor: TEXT, + }, + }, editButtonBox: { paddingTop: '.3em', }, @@ -64,6 +80,15 @@ const useStyles = makeStyles((theme) => ({ paddingTop: '.8em', paddingBottom: '.8em', }, + power: { + color: 'black', + }, + on: { + color: BLUE, + }, + off: { + color: RED, + }, })); const selectDecorator = (state: string): Colours => { @@ -100,13 +125,11 @@ const Servers = ({ anvil }: { anvil: AnvilListItem[] }): JSX.Element => { const handleChange = (server_uuid: string): void => { const index = selected.indexOf(server_uuid); - if (index === -1) { - selected.push(server_uuid); - setSelected([...selected]); - } else { - selected.splice(index, 1); - setSelected([...selected]); - } + + if (index === -1) selected.push(server_uuid); + else selected.splice(index, 1); + + setSelected([...selected]); }; const anvilIndex = anvil.findIndex((a) => a.anvil_uuid === uuid); @@ -120,12 +143,13 @@ const Servers = ({ anvil }: { anvil: AnvilListItem[] }): JSX.Element => { - { open={Boolean(anchorEl)} onClose={handleClose} > - - + + + On + - - + + + Off + @@ -172,14 +205,14 @@ const Servers = ({ anvil }: { anvil: AnvilListItem[] }): JSX.Element => { {showCheckbox && ( s === server.server_uuid, ) !== undefined } onChange={() => handleChange(server.server_uuid)} - inputProps={{ 'aria-label': 'primary checkbox' }} /> )}