fix(striker-ui): isolate PanelHeader and apply to Servers panel

main
Tsu-ba-me 3 years ago
parent d0b36e9f99
commit c1ad5a513b
  1. 15
      striker-ui/components/Panels/PanelHeader.tsx
  2. 3
      striker-ui/components/Panels/index.tsx
  3. 22
      striker-ui/components/Servers.tsx

@ -0,0 +1,15 @@
import { Box, styled } from '@mui/material';
const PanelHeader = styled(Box)({
alignItems: 'center',
display: 'flex',
flexDirection: 'row',
marginBottom: '1em',
width: '100%',
'& > :first-child': { flexGrow: 1 },
'& > :not(:first-child, :last-child)': {
marginRight: '.3em',
},
});
export default PanelHeader;

@ -1,5 +1,6 @@
import InnerPanel from './InnerPanel'; import InnerPanel from './InnerPanel';
import InnerPanelHeader from './InnerPanelHeader'; import InnerPanelHeader from './InnerPanelHeader';
import Panel from './Panel'; import Panel from './Panel';
import PanelHeader from './PanelHeader';
export { InnerPanel, InnerPanelHeader, Panel }; export { InnerPanel, InnerPanelHeader, Panel, PanelHeader };

@ -10,11 +10,14 @@ import {
MenuItem, MenuItem,
Typography, Typography,
} from '@mui/material'; } from '@mui/material';
import EditIcon from '@mui/icons-material/Edit'; import {
import MoreVertIcon from '@mui/icons-material/MoreVert'; Add as AddIcon,
import CheckIcon from '@mui/icons-material/Check'; Check as CheckIcon,
Edit as EditIcon,
MoreVert as MoreVertIcon,
} from '@mui/icons-material';
import { styled } from '@mui/material/styles'; import { styled } from '@mui/material/styles';
import { Panel } from './Panels'; import { Panel, PanelHeader } from './Panels';
import PeriodicFetch from '../lib/fetchers/periodicFetch'; import PeriodicFetch from '../lib/fetchers/periodicFetch';
import { HeaderText, BodyText } from './Text'; import { HeaderText, BodyText } from './Text';
import { import {
@ -227,16 +230,15 @@ const Servers = ({ anvil }: { anvil: AnvilListItem[] }): JSX.Element => {
return ( return (
<Panel> <Panel>
<StyledDiv> <StyledDiv>
<Box className={classes.headerPadding} display="flex"> <PanelHeader className={classes.headerPadding} sx={{ marginBottom: 0 }}>
<Box flexGrow={1}>
<HeaderText text="Servers" /> <HeaderText text="Servers" />
</Box> <IconButton>
<Box className={classes.editButtonBox}> <AddIcon />
</IconButton>
<IconButton onClick={() => setShowCheckbox(!showCheckbox)}> <IconButton onClick={() => setShowCheckbox(!showCheckbox)}>
{showCheckbox ? <CheckIcon /> : <EditIcon />} {showCheckbox ? <CheckIcon /> : <EditIcon />}
</IconButton> </IconButton>
</Box> </PanelHeader>
</Box>
{showCheckbox && ( {showCheckbox && (
<> <>
<Box className={classes.headerPadding} display="flex"> <Box className={classes.headerPadding} display="flex">

Loading…
Cancel
Save