refactor: add better alignment and a divider to the resource component

main
Josue 4 years ago
parent fa7950057c
commit 32b3b6a1f8
  1. 32
      striker-ui/components/Resource/ResourceVolumes.tsx

@ -1,6 +1,5 @@
import * as prettyBytes from 'pretty-bytes'; import * as prettyBytes from 'pretty-bytes';
import { makeStyles } from '@material-ui/core/styles'; import { makeStyles, Box, Divider } from '@material-ui/core';
import { Box } from '@material-ui/core';
import InsertLinkIcon from '@material-ui/icons/InsertLink'; import InsertLinkIcon from '@material-ui/icons/InsertLink';
import { InnerPanel, PanelHeader } from '../Panels'; import { InnerPanel, PanelHeader } from '../Panels';
import { BodyText } from '../Text'; import { BodyText } from '../Text';
@ -20,6 +19,7 @@ const useStyles = makeStyles((theme) => ({
paddingLeft: '.7em', paddingLeft: '.7em',
paddingRight: '.7em', paddingRight: '.7em',
paddingTop: '1em', paddingTop: '1em',
paddingBottom: '.7em',
}, },
bar: { bar: {
paddingLeft: '.7em', paddingLeft: '.7em',
@ -35,6 +35,9 @@ const useStyles = makeStyles((theme) => ({
decoratorBox: { decoratorBox: {
paddingRight: '.3em', paddingRight: '.3em',
}, },
divider: {
background: DIVIDER,
},
})); }));
const selectDecorator = (state: string): Colours => { const selectDecorator = (state: string): Colours => {
@ -78,6 +81,7 @@ const ResourceVolumes = ({
{volume.connections.map( {volume.connections.map(
(connection): JSX.Element => { (connection): JSX.Element => {
return ( return (
<>
<Box <Box
key={connection.fencing} key={connection.fencing}
display="flex" display="flex"
@ -86,14 +90,32 @@ const ResourceVolumes = ({
> >
<Box className={classes.decoratorBox}> <Box className={classes.decoratorBox}>
<Decorator <Decorator
colour={selectDecorator(connection.connection_state)} colour={selectDecorator(
connection.connection_state,
)}
/> />
</Box> </Box>
<BodyText text={connection.targets[0].target_name} /> <Box>
<Box display="flex" width="100%">
<BodyText
text={connection.targets[0].target_name}
/>
<InsertLinkIcon style={{ color: DIVIDER }} /> <InsertLinkIcon style={{ color: DIVIDER }} />
<BodyText text={connection.targets[1].target_name} /> <BodyText
text={connection.targets[1].target_name}
/>
</Box>
<Box
display="flex"
justifyContent="center"
width="100%"
>
<BodyText text={connection.connection_state} /> <BodyText text={connection.connection_state} />
</Box> </Box>
</Box>
</Box>
<Divider className={classes.divider} />
</>
); );
}, },
)} )}

Loading…
Cancel
Save