From 5589015b07ae5778596cedd4d1f429a71c3c34ea Mon Sep 17 00:00:00 2001 From: Brian Cooper Date: Wed, 14 Oct 2020 15:54:42 -0400 Subject: [PATCH 1/2] fix(app): remove redundant tip rack display name from tooltip --- .../CalibratePanel/PipetteTiprackListItem.js | 62 +++++++------------ components/src/lists/ListItem.js | 6 ++ 2 files changed, 30 insertions(+), 38 deletions(-) diff --git a/app/src/components/CalibratePanel/PipetteTiprackListItem.js b/app/src/components/CalibratePanel/PipetteTiprackListItem.js index 71270ab5287..3f91dc8c1a9 100644 --- a/app/src/components/CalibratePanel/PipetteTiprackListItem.js +++ b/app/src/components/CalibratePanel/PipetteTiprackListItem.js @@ -4,10 +4,14 @@ import { useSelector } from 'react-redux' import { ListItem, - HoverTooltip, + useHoverTooltip, + TOOLTIP_BOTTOM, + Tooltip, Box, Text, FONT_WEIGHT_SEMIBOLD, + FONT_SIZE_BODY_1, + C_WHITE, } from '@opentrons/components' import styles from './styles.css' @@ -52,44 +56,26 @@ export function PipetteTiprackListItem( ) : null ) - return ( - - } - > - {tooltipHandlers => ( - - - {displayName} - - - - )} - - ) -} - -function TiprackNameTooltip(props: {| name: string, displayName: string |}) { - const { name, displayName } = props + const [targetProps, tooltipProps] = useHoverTooltip({ + placement: TOOLTIP_BOTTOM, + }) return ( -
-

{name}

-

{displayName}

-
+ + + {displayName} + + + + + {name} + + + ) } diff --git a/components/src/lists/ListItem.js b/components/src/lists/ListItem.js index 50196d7d988..32abcbe6919 100644 --- a/components/src/lists/ListItem.js +++ b/components/src/lists/ListItem.js @@ -14,6 +14,10 @@ type ListItemProps = {| onMouseEnter?: (event: SyntheticMouseEvent<>) => mixed, /** mouse leave handler */ onMouseLeave?: (event: SyntheticMouseEvent<>) => mixed, + /** mouse enter handler */ + onPointerEnter?: (event: SyntheticPointerEvent<>) => mixed, + /** mouse leave handler */ + onPointerLeave?: (event: SyntheticPointerEvent<>) => mixed, /** if URL is specified, ListItem is wrapped in a React Router NavLink */ url?: string | null, /** if URL is specified NavLink can receive an active class name */ @@ -26,6 +30,8 @@ type ListItemProps = {| isDisabled?: boolean, /** name constant of the icon to display */ iconName?: IconName, + 'aria-describedby'?: string, + ref?: {| current: Element | null |} | ((current: Element | null) => mixed), children: React.Node, |} From beef05b8bc05d7f5f9fa8ca64ae40e38ddb06e3c Mon Sep 17 00:00:00 2001 From: Brian Cooper Date: Wed, 14 Oct 2020 17:09:49 -0400 Subject: [PATCH 2/2] update labware list item tooltip as well --- .../CalibratePanel/LabwareListItem.js | 99 +++++++++---------- 1 file changed, 44 insertions(+), 55 deletions(-) diff --git a/app/src/components/CalibratePanel/LabwareListItem.js b/app/src/components/CalibratePanel/LabwareListItem.js index 09344cd063b..e1ae27d23ed 100644 --- a/app/src/components/CalibratePanel/LabwareListItem.js +++ b/app/src/components/CalibratePanel/LabwareListItem.js @@ -8,7 +8,15 @@ import { getModuleType, THERMOCYCLER_MODULE_TYPE, } from '@opentrons/shared-data' -import { ListItem, HoverTooltip } from '@opentrons/components' +import { + ListItem, + Flex, + Tooltip, + Text, + useHoverTooltip, + FONT_SIZE_BODY_1, + C_WHITE, +} from '@opentrons/components' import { CalibrationData } from './CalibrationData' import type { BaseProtocolLabware } from '../../calibration/labware/types' import styles from './styles.css' @@ -44,6 +52,8 @@ export function LabwareListItem(props: LabwareListItemProps): React.Node { } const moduleDisplayName = parent && getModuleDisplayName(parent) + const [targetProps, tooltipProps] = useHoverTooltip() + return ( - - } - > - {handlers => ( -
- {displaySlot} -
- {parent && ( - {moduleDisplayName} - )} - - {isTiprack ? ( - - - {calibratorMount - ? calibratorMount.charAt(0).toUpperCase() - : ''} - - {displayName} - - ) : ( - displayName - )} + + {displaySlot} +
+ {parent && ( + {moduleDisplayName} + )} + + {isTiprack ? ( + + + {calibratorMount + ? calibratorMount.charAt(0).toUpperCase() + : ''} + + {displayName} - -
-
- )} - + ) : ( + displayName + )} + + +
+ + + + {name} + +
) } - -function LabwareNameTooltip(props: {| name: string, displayName: string |}) { - const { name, displayName } = props - - return ( -
-

{name}

-

{displayName}

-
- ) -}