fix: add padding for better header display, and change overflow depending on screen size

main
Josue 4 years ago committed by Tsu-ba-me
parent c7d2d6c925
commit 04b5f6e9fd
  1. 14
      striker-ui/components/Nodes/AnvilNode.tsx
  2. 72
      striker-ui/components/SharedStorage.tsx

@ -1,4 +1,4 @@
import { Box, List, Switch } from '@material-ui/core';
import { Box, Switch } from '@material-ui/core';
import { makeStyles } from '@material-ui/core/styles';
import { ClassNameMap } from '@material-ui/styles';
@ -9,11 +9,15 @@ import PanelHeader from '../PanelHeader';
import { BLUE, RED_ON, TEXT, PURPLE_OFF } from '../../lib/consts/DEFAULT_THEME';
import nodeState from '../../lib/consts/NODES';
const useStyles = makeStyles(() => ({
const useStyles = makeStyles((theme) => ({
root: {
width: '100%',
overflow: 'auto',
height: '30vh',
paddingLeft: '5px',
[theme.breakpoints.down('md')]: {
height: '100%',
overflow: 'hidden',
},
},
state: {
paddingLeft: '10px',
@ -76,7 +80,7 @@ const AnvilNode = ({
}): JSX.Element => {
const classes = useStyles();
return (
<List component="nav" className={classes.root} aria-label="mailbox folders">
<Box className={classes.root}>
{nodes &&
nodes.map(
(node): JSX.Element => {
@ -136,7 +140,7 @@ const AnvilNode = ({
);
},
)}
</List>
</Box>
);
};

@ -10,11 +10,19 @@ import PanelHeader from './PanelHeader';
import PeriodicFetch from '../lib/fetchers/periodicFetch';
import { AnvilContext } from './AnvilContext';
const useStyles = makeStyles(() => ({
const useStyles = makeStyles((theme) => ({
header: {
paddingTop: '3px',
paddingRight: '10px',
},
root: {
overflow: 'auto',
height: '80vh',
paddingLeft: '5px',
[theme.breakpoints.down('md')]: {
height: '100%',
},
},
}));
const SharedStorage = ({ anvil }: { anvil: AnvilListItem[] }): JSX.Element => {
@ -27,37 +35,39 @@ const SharedStorage = ({ anvil }: { anvil: AnvilListItem[] }): JSX.Element => {
return (
<Panel>
<HeaderText text="Shared Storage" />
{data?.file_systems &&
data.file_systems.map(
(fs: AnvilSharedStorageFileSystem): JSX.Element => (
<InnerPanel key={fs.mount_point}>
<PanelHeader>
<Box display="flex" width="100%" className={classes.header}>
<Box>
<BodyText text={fs.mount_point} />
<Box className={classes.root}>
{data?.file_systems &&
data.file_systems.map(
(fs: AnvilSharedStorageFileSystem): JSX.Element => (
<InnerPanel key={fs.mount_point}>
<PanelHeader>
<Box display="flex" width="100%" className={classes.header}>
<Box>
<BodyText text={fs.mount_point} />
</Box>
</Box>
</Box>
</PanelHeader>
{fs?.nodes &&
fs.nodes.map(
(
node: AnvilSharedStorageNode,
index: number,
): JSX.Element => (
<SharedStorageNode
node={{
...node,
nodeInfo:
anvil[anvil.findIndex((a) => a.anvil_uuid === uuid)]
.nodes[index],
}}
key={fs.nodes[index].free}
/>
),
)}
</InnerPanel>
),
)}
</PanelHeader>
{fs?.nodes &&
fs.nodes.map(
(
node: AnvilSharedStorageNode,
index: number,
): JSX.Element => (
<SharedStorageNode
node={{
...node,
nodeInfo:
anvil[anvil.findIndex((a) => a.anvil_uuid === uuid)]
.nodes[index],
}}
key={fs.nodes[index].free}
/>
),
)}
</InnerPanel>
),
)}
</Box>
</Panel>
);
};

Loading…
Cancel
Save