From 04b5f6e9fd05fcf832bea359bd7080357dc4ec69 Mon Sep 17 00:00:00 2001 From: Josue Date: Fri, 30 Apr 2021 11:11:47 -0400 Subject: [PATCH] fix: add padding for better header display, and change overflow depending on screen size --- striker-ui/components/Nodes/AnvilNode.tsx | 14 +++-- striker-ui/components/SharedStorage.tsx | 72 +++++++++++++---------- 2 files changed, 50 insertions(+), 36 deletions(-) diff --git a/striker-ui/components/Nodes/AnvilNode.tsx b/striker-ui/components/Nodes/AnvilNode.tsx index f0735dd6..141f9775 100644 --- a/striker-ui/components/Nodes/AnvilNode.tsx +++ b/striker-ui/components/Nodes/AnvilNode.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 ( - + {nodes && nodes.map( (node): JSX.Element => { @@ -136,7 +140,7 @@ const AnvilNode = ({ ); }, )} - + ); }; diff --git a/striker-ui/components/SharedStorage.tsx b/striker-ui/components/SharedStorage.tsx index 9adeabc4..0ddb0831 100644 --- a/striker-ui/components/SharedStorage.tsx +++ b/striker-ui/components/SharedStorage.tsx @@ -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 ( - {data?.file_systems && - data.file_systems.map( - (fs: AnvilSharedStorageFileSystem): JSX.Element => ( - - - - - + + {data?.file_systems && + data.file_systems.map( + (fs: AnvilSharedStorageFileSystem): JSX.Element => ( + + + + + + - - - {fs?.nodes && - fs.nodes.map( - ( - node: AnvilSharedStorageNode, - index: number, - ): JSX.Element => ( - a.anvil_uuid === uuid)] - .nodes[index], - }} - key={fs.nodes[index].free} - /> - ), - )} - - ), - )} + + {fs?.nodes && + fs.nodes.map( + ( + node: AnvilSharedStorageNode, + index: number, + ): JSX.Element => ( + a.anvil_uuid === uuid)] + .nodes[index], + }} + key={fs.nodes[index].free} + /> + ), + )} + + ), + )} + ); };