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 InnerPanelHeader from './InnerPanelHeader';
import Panel from './Panel';
import PanelHeader from './PanelHeader';
export { InnerPanel, InnerPanelHeader, Panel };
export { InnerPanel, InnerPanelHeader, Panel, PanelHeader };

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

Loading…
Cancel
Save