refactor: handle overflow in the Nodes component

main
Josue 4 years ago committed by Tsu-ba-me
parent a5ba0a7c50
commit 6a2433878f
  1. 17
      striker-ui/components/Nodes/AnvilNode.tsx

@ -1,4 +1,4 @@
import { Box, Switch } from '@material-ui/core'; import { Box, List, Switch } from '@material-ui/core';
import { makeStyles } from '@material-ui/core/styles'; import { makeStyles } from '@material-ui/core/styles';
import { ClassNameMap } from '@material-ui/styles'; import { ClassNameMap } from '@material-ui/styles';
@ -9,6 +9,11 @@ import PanelHeader from '../PanelHeader';
import { BLUE, RED_ON, TEXT, PURPLE_OFF } from '../../lib/consts/DEFAULT_THEME'; import { BLUE, RED_ON, TEXT, PURPLE_OFF } from '../../lib/consts/DEFAULT_THEME';
const useStyles = makeStyles(() => ({ const useStyles = makeStyles(() => ({
root: {
width: '100%',
overflow: 'auto',
height: '30vh',
},
state: { state: {
paddingLeft: '10px', paddingLeft: '10px',
paddingRight: '10px', paddingRight: '10px',
@ -18,6 +23,10 @@ const useStyles = makeStyles(() => ({
paddingLeft: '10px', paddingLeft: '10px',
paddingRight: '10px', paddingRight: '10px',
}, },
header: {
paddingTop: '3px',
paddingRight: '10px',
},
label: { label: {
paddingTop: '5px', paddingTop: '5px',
}, },
@ -66,14 +75,14 @@ const AnvilNode = ({
}): JSX.Element => { }): JSX.Element => {
const classes = useStyles(); const classes = useStyles();
return ( return (
<> <List component="nav" className={classes.root} aria-label="mailbox folders">
{nodes && {nodes &&
nodes.map( nodes.map(
(node): JSX.Element => { (node): JSX.Element => {
return ( return (
<InnerPanel key={node.node_uuid}> <InnerPanel key={node.node_uuid}>
<PanelHeader> <PanelHeader>
<Box display="flex" width="100%"> <Box display="flex" width="100%" className={classes.header}>
<Box flexGrow={1}> <Box flexGrow={1}>
<BodyText text={node.node_name} /> <BodyText text={node.node_name} />
</Box> </Box>
@ -124,7 +133,7 @@ const AnvilNode = ({
); );
}, },
)} )}
</> </List>
); );
}; };

Loading…
Cancel
Save