fix(striker-ui): isolate custom IconButton in Servers

main
Tsu-ba-me 3 years ago
parent 3636f155fc
commit 3dff61b966
  1. 19
      striker-ui/components/IconButton/IconButton.tsx
  2. 3
      striker-ui/components/IconButton/index.tsx
  3. 11
      striker-ui/components/Servers.tsx

@ -0,0 +1,19 @@
import { IconButton as MUIIconButton, styled } from '@mui/material';
import {
BLACK,
BORDER_RADIUS,
GREY,
TEXT,
} from '../../lib/consts/DEFAULT_THEME';
const IconButton = styled(MUIIconButton)({
borderRadius: BORDER_RADIUS,
backgroundColor: GREY,
'&:hover': {
backgroundColor: TEXT,
},
color: BLACK,
});
export default IconButton;

@ -0,0 +1,3 @@
import IconButton from './IconButton';
export default IconButton;

@ -4,7 +4,6 @@ import {
ListItem, ListItem,
Divider, Divider,
Box, Box,
IconButton,
Button, Button,
Checkbox, Checkbox,
Menu, Menu,
@ -28,10 +27,10 @@ import {
BLACK, BLACK,
LARGE_MOBILE_BREAKPOINT, LARGE_MOBILE_BREAKPOINT,
} from '../lib/consts/DEFAULT_THEME'; } from '../lib/consts/DEFAULT_THEME';
import ICON_BUTTON_STYLE from '../lib/consts/ICON_BUTTON_STYLE';
import { AnvilContext } from './AnvilContext'; import { AnvilContext } from './AnvilContext';
import serverState from '../lib/consts/SERVERS'; import serverState from '../lib/consts/SERVERS';
import Decorator, { Colours } from './Decorator'; import Decorator, { Colours } from './Decorator';
import IconButton from './IconButton';
import Spinner from './Spinner'; import Spinner from './Spinner';
import hostsSanitizer from '../lib/sanitizers/hostsSanitizer'; import hostsSanitizer from '../lib/sanitizers/hostsSanitizer';
@ -49,7 +48,6 @@ const classes = {
hostBox: `${PREFIX}-hostBox`, hostBox: `${PREFIX}-hostBox`,
checkbox: `${PREFIX}-checkbox`, checkbox: `${PREFIX}-checkbox`,
serverActionButton: `${PREFIX}-serverActionButton`, serverActionButton: `${PREFIX}-serverActionButton`,
editButton: `${PREFIX}-editButton`,
editButtonBox: `${PREFIX}-editButtonBox`, editButtonBox: `${PREFIX}-editButtonBox`,
dropdown: `${PREFIX}-dropdown`, dropdown: `${PREFIX}-dropdown`,
power: `${PREFIX}-power`, power: `${PREFIX}-power`,
@ -112,8 +110,6 @@ const StyledDiv = styled('div')(({ theme }) => ({
}, },
}, },
[`& .${classes.editButton}`]: ICON_BUTTON_STYLE,
[`& .${classes.editButtonBox}`]: { [`& .${classes.editButtonBox}`]: {
paddingTop: '.3em', paddingTop: '.3em',
}, },
@ -236,10 +232,7 @@ const Servers = ({ anvil }: { anvil: AnvilListItem[] }): JSX.Element => {
<HeaderText text="Servers" /> <HeaderText text="Servers" />
</Box> </Box>
<Box className={classes.editButtonBox}> <Box className={classes.editButtonBox}>
<IconButton <IconButton onClick={() => setShowCheckbox(!showCheckbox)}>
className={classes.editButton}
onClick={() => setShowCheckbox(!showCheckbox)}
>
{showCheckbox ? <CheckIcon /> : <EditIcon />} {showCheckbox ? <CheckIcon /> : <EditIcon />}
</IconButton> </IconButton>
</Box> </Box>

Loading…
Cancel
Save