From a30edc5f128ef31d3f84257b2821159c616ea866 Mon Sep 17 00:00:00 2001 From: Kadee80 Date: Mon, 17 Sep 2018 14:12:57 -0400 Subject: [PATCH] Refactor robot list --- app/src/components/ConnectPanel/RobotLink.js | 29 ++++++++ app/src/components/ConnectPanel/RobotList.js | 72 +++++++++---------- .../components/ConnectPanel/connect-panel.css | 25 ++++--- app/src/components/ConnectPanel/index.js | 15 ++-- components/src/nav/SidePanel.css | 2 +- 5 files changed, 85 insertions(+), 58 deletions(-) create mode 100644 app/src/components/ConnectPanel/RobotLink.js diff --git a/app/src/components/ConnectPanel/RobotLink.js b/app/src/components/ConnectPanel/RobotLink.js new file mode 100644 index 000000000000..8d47b5a32e59 --- /dev/null +++ b/app/src/components/ConnectPanel/RobotLink.js @@ -0,0 +1,29 @@ +// @flow +// Robot and Instrument links specific to RobotListItem +import * as React from 'react' +import {NavLink} from 'react-router-dom' + +import cx from 'classnames' +import styles from './connect-panel.css' + +type LinkProps = { + children: React.Node, + url: string, + className?: string, + activeClassName?: string, +} + +export default function RobotLink (props: LinkProps) { + const {url} = props + const className = cx(styles.robot_link, props.className) + return ( + + {props.children} + + ) +} diff --git a/app/src/components/ConnectPanel/RobotList.js b/app/src/components/ConnectPanel/RobotList.js index 2b885edcd238..6c3ad1f9facb 100644 --- a/app/src/components/ConnectPanel/RobotList.js +++ b/app/src/components/ConnectPanel/RobotList.js @@ -3,13 +3,13 @@ import * as React from 'react' import { - ListItem, NotificationIcon, Icon, } from '@opentrons/components' import type {Robot} from '../../robot' import {ToggleButton} from '../controls' +import RobotLink from './RobotLink' import styles from './connect-panel.css' type ListProps = { @@ -37,43 +37,41 @@ export function RobotListItem (props: ItemProps) { : connect return ( -
    - - +
  1. + + -

    - {name} -

    +

    + {name} +

    - - - -

    - Pipettes & Modules -

    - -
    -
+ + + +

+ Pipettes & Modules +

+ +
+ ) } diff --git a/app/src/components/ConnectPanel/connect-panel.css b/app/src/components/ConnectPanel/connect-panel.css index 16f79c5f1edb..67eaf2a2639c 100644 --- a/app/src/components/ConnectPanel/connect-panel.css +++ b/app/src/components/ConnectPanel/connect-panel.css @@ -6,24 +6,27 @@ } .robot_group { - margin-bottom: 0.25rem; + margin-bottom: 0.5rem; box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.1); +} + +.robot_link { + @apply --font-body-1-dark; - & > li { - max-height: 3rem; - } + display: flex; + flex-direction: row; + align-items: center; + padding: 0 0.75rem; + border-bottom: 1px solid var(--c-light-gray); + text-transform: uppercase; } .robot_item { - max-height: 3rem; - text-transform: uppercase; - border-bottom: 1px solid var(--c-light-gray); + height: 3rem; } .instrument_item { - max-height: 2.5rem; - text-transform: uppercase; - border-bottom: 1px solid var(--c-light-gray); + height: 2.5rem; } .robot_item_icon { @@ -36,7 +39,7 @@ color: var(--c-orange); } -.robot_name { +.link_text { flex: 1; margin: 0 0.5rem; font-weight: bold; diff --git a/app/src/components/ConnectPanel/index.js b/app/src/components/ConnectPanel/index.js index dba1312e6c35..acc598e16ece 100644 --- a/app/src/components/ConnectPanel/index.js +++ b/app/src/components/ConnectPanel/index.js @@ -30,15 +30,12 @@ export default connect(mapStateToProps, mapDispatchToProps)(ConnectPanel) function ConnectPanel (props: Props) { return ( -
- - - {props.robots.map((robot) => ( - // $FlowFixMe: flow-typed withRouter def throwing bogus errors - - ))} - -
+ + + {props.robots.map((robot) => ( + + ))} +
) } diff --git a/components/src/nav/SidePanel.css b/components/src/nav/SidePanel.css index e1a381395333..77f0ee0a9239 100644 --- a/components/src/nav/SidePanel.css +++ b/components/src/nav/SidePanel.css @@ -33,7 +33,7 @@ .panel_contents { width: var(--sidebar-width); - height: calc(100vh - 4.25rem); + height: calc(100vh - 3.5rem); overflow-x: hidden; overflow-y: auto; }