From 3f042410f7613547a6a215a6b9f8d6850650c85f Mon Sep 17 00:00:00 2001 From: csrapr <26280794+csrapr@users.noreply.github.com> Date: Thu, 11 Feb 2021 19:33:24 +0000 Subject: [PATCH] Feat: cards same height in Dashboard Fix: merge alerts.new.styles into alerts.styles --- .../src/components/CollapsibleCard.js | 11 +- .../src/pages/Dashboard/Alerts/Alerts.js | 37 +++--- .../pages/Dashboard/Alerts/Alerts.styles.js | 62 ++++------ .../src/pages/Dashboard/Dashboard.js | 9 +- .../src/pages/Dashboard/Dashboard.styles.js | 37 +++--- .../pages/Dashboard/Footer/Footer.styles.js | 5 +- .../src/pages/Dashboard/LeftSide.js | 10 +- .../src/pages/Dashboard/RightSide.js | 112 ++++++++++-------- .../SystemPerformance.styles.js | 2 + .../SystemStatus/MachinesTable.styles.js | 12 +- .../Dashboard/SystemStatus/SystemStatus.js | 30 ++--- 11 files changed, 168 insertions(+), 159 deletions(-) diff --git a/new-lamassu-admin/src/components/CollapsibleCard.js b/new-lamassu-admin/src/components/CollapsibleCard.js index 0814ffce..574340a1 100644 --- a/new-lamassu-admin/src/components/CollapsibleCard.js +++ b/new-lamassu-admin/src/components/CollapsibleCard.js @@ -1,5 +1,6 @@ import Grid from '@material-ui/core/Grid' import { makeStyles } from '@material-ui/core/styles' +import classnames from 'classnames' import PropTypes from 'prop-types' import React from 'react' @@ -26,13 +27,9 @@ const useStyles = makeStyles(styles) const CollapsibleCard = ({ className, state, shrunkComponent, children }) => { const classes = useStyles() return ( -
- -
- {state === cardState.SHRUNK ? shrunkComponent : children} -
-
-
+ + {state === cardState.SHRUNK ? shrunkComponent : children} + ) } diff --git a/new-lamassu-admin/src/pages/Dashboard/Alerts/Alerts.js b/new-lamassu-admin/src/pages/Dashboard/Alerts/Alerts.js index baa9fc11..7d6502e1 100644 --- a/new-lamassu-admin/src/pages/Dashboard/Alerts/Alerts.js +++ b/new-lamassu-admin/src/pages/Dashboard/Alerts/Alerts.js @@ -7,11 +7,10 @@ import gql from 'graphql-tag' import * as R from 'ramda' import React from 'react' -import { cardState as cardState_ } from 'src/components/CollapsibleCard' +import { cardState } from 'src/components/CollapsibleCard' import { Label1, H4 } from 'src/components/typography' -import styles from '../Dashboard.styles' - +import styles from './Alerts.styles' import AlertsTable from './AlertsTable' const NUM_TO_RENDER = 3 @@ -38,7 +37,7 @@ const useStyles = makeStyles(styles) const Alerts = ({ onReset, onExpand, size }) => { const classes = useStyles() - const showAllItems = size === cardState_.EXPANDED + const showAllItems = size === cardState.EXPANDED const { data } = useQuery(GET_ALERTS) const alerts = R.path(['alerts'])(data) ?? [] const machines = R.compose( @@ -73,9 +72,9 @@ const Alerts = ({ onReset, onExpand, size }) => { className={classnames(alertsTableContainerClasses)} container spacing={1}> - + {!alerts.length && ( - + No new alerts. Your system is running smoothly. )} @@ -84,20 +83,22 @@ const Alerts = ({ onReset, onExpand, size }) => { alerts={alerts} machines={machines} /> - {!showAllItems && alertsLength > NUM_TO_RENDER && ( - - - - )} + {!showAllItems && alertsLength > NUM_TO_RENDER && ( + + + + + + )} ) } diff --git a/new-lamassu-admin/src/pages/Dashboard/Alerts/Alerts.styles.js b/new-lamassu-admin/src/pages/Dashboard/Alerts/Alerts.styles.js index 382102eb..7aa2ebe7 100644 --- a/new-lamassu-admin/src/pages/Dashboard/Alerts/Alerts.styles.js +++ b/new-lamassu-admin/src/pages/Dashboard/Alerts/Alerts.styles.js @@ -1,39 +1,26 @@ -import { - backgroundColor, - offColor, - errorColor, - primaryColor, - spacer -} from 'src/styling/variables' +import { primaryColor, comet } from 'src/styling/variables' const styles = { container: { display: 'flex', justifyContent: 'space-between' }, - centerLabel: { - textAlign: 'center', - marginBottom: 0, - marginTop: 0 - }, - label: { + h4: { margin: 0, - color: offColor + marginBottom: 10 }, - row: { - backgroundColor: backgroundColor, - borderBottom: 'none' + centerLabel: { + marginBottom: 0, + padding: 0, + textAlign: 'center' }, - header: { - display: 'flex', - alignItems: 'center', - whiteSpace: 'pre' - }, - error: { - color: errorColor + upperButtonLabel: { + marginTop: -3, + marginBottom: 24 }, button: { color: primaryColor, + marginTop: 0, minHeight: 0, minWidth: 0, padding: 0, @@ -42,24 +29,21 @@ const styles = { backgroundColor: 'transparent' } }, - statusHeader: { - marginLeft: 2 + alertsTableContainer: { + margin: 0 + }, + expandedAlertsTableContainer: { + margin: 0, + maxHeight: 460 + }, + noAlertsLabel: { + color: comet, + marginLeft: -5 }, table: { - marginTop: spacer * 4, maxHeight: 465, - overflow: 'auto' - }, - tableBody: { - overflow: 'auto' - }, - h4: { - marginTop: 0 - }, - buttonLabel: { - textAlign: 'center', - marginBottom: 0, - marginTop: 0 + overflowX: 'hidden', + overflowY: 'auto' }, listItemText: { margin: '8px 0 8px 0' diff --git a/new-lamassu-admin/src/pages/Dashboard/Dashboard.js b/new-lamassu-admin/src/pages/Dashboard/Dashboard.js index dd875662..5d4997de 100644 --- a/new-lamassu-admin/src/pages/Dashboard/Dashboard.js +++ b/new-lamassu-admin/src/pages/Dashboard/Dashboard.js @@ -34,10 +34,15 @@ const Dashboard = () => { +
- - + + + + + +