From 54dda4098bf1edadb0d75b9920afa9305f1f525c Mon Sep 17 00:00:00 2001
From: Nick Diehl <47604184+ncdiehl11@users.noreply.github.com>
Date: Thu, 21 Nov 2024 15:34:45 -0500
Subject: [PATCH 1/2] fix(components): fix EmptySelectorButton style (#16932)
Add hover state and fix border radius for EmptySelectorButton component
Closes RQA-3659
---
.../src/atoms/buttons/EmptySelectorButton.tsx | 44 +++++++++----------
1 file changed, 22 insertions(+), 22 deletions(-)
diff --git a/components/src/atoms/buttons/EmptySelectorButton.tsx b/components/src/atoms/buttons/EmptySelectorButton.tsx
index 42e8822fc35..da34a8ba710 100644
--- a/components/src/atoms/buttons/EmptySelectorButton.tsx
+++ b/components/src/atoms/buttons/EmptySelectorButton.tsx
@@ -1,27 +1,18 @@
import styled from 'styled-components'
import { Flex } from '../../primitives'
import {
+ ALIGN_CENTER,
CURSOR_DEFAULT,
CURSOR_POINTER,
+ FLEX_MAX_CONTENT,
Icon,
- SPACING,
- StyledText,
JUSTIFY_CENTER,
JUSTIFY_START,
- ALIGN_CENTER,
- FLEX_MAX_CONTENT,
+ SPACING,
+ StyledText,
} from '../../index'
-import {
- black90,
- blue30,
- blue50,
- grey30,
- grey40,
- white,
-} from '../../helix-design-system/colors'
-import { borderRadius8 } from '../../helix-design-system/borders'
+import { BORDERS, COLORS } from '../../helix-design-system'
import type { IconName } from '../../index'
-
interface EmptySelectorButtonProps {
onClick: () => void
text: string
@@ -41,10 +32,9 @@ export function EmptySelectorButton(
`
border: none;
width: ${FLEX_MAX_CONTENT};
height: ${FLEX_MAX_CONTENT};
- cursor: ${({ disabled }) => (disabled ? CURSOR_DEFAULT : CURSOR_POINTER)};
+ cursor: ${CURSOR_POINTER};
+ background-color: ${COLORS.blue30};
+ border-radius: ${BORDERS.borderRadius8};
+
&:focus-visible {
- outline: 2px solid ${white};
- box-shadow: 0 0 0 4px ${blue50};
- border-radius: ${borderRadius8};
+ outline: 2px solid ${COLORS.white};
+ box-shadow: 0 0 0 4px ${COLORS.blue50};
+ border-radius: ${BORDERS.borderRadius8};
+ }
+ &:hover {
+ background-color: ${COLORS.blue35};
+ }
+ &:disabled {
+ background-color: ${COLORS.grey20};
+ cursor: ${CURSOR_DEFAULT};
}
`
From 7411eaf27eb34acd3670d4aa1dd15388fca2217e Mon Sep 17 00:00:00 2001
From: Nick Diehl <47604184+ncdiehl11@users.noreply.github.com>
Date: Thu, 21 Nov 2024 15:35:01 -0500
Subject: [PATCH 2/2] fix(components, protocol-designer): hug hotkey shortcut
tag width (#16936)
Add optional shrinkToContent to Tag component
Closes [RQA-3667](https://opentrons.atlassian.net/browse/RQA-3667)
---
components/src/atoms/Tag/index.tsx | 6 ++--
.../localization/en/starting_deck_state.json | 4 +--
.../__tests__/ProtocolSteps.test.tsx | 4 +--
.../pages/Designer/ProtocolSteps/index.tsx | 31 ++++++++++++++-----
4 files changed, 31 insertions(+), 14 deletions(-)
diff --git a/components/src/atoms/Tag/index.tsx b/components/src/atoms/Tag/index.tsx
index c41025dd25b..74c72da486e 100644
--- a/components/src/atoms/Tag/index.tsx
+++ b/components/src/atoms/Tag/index.tsx
@@ -1,7 +1,7 @@
import { css } from 'styled-components'
import { BORDERS, COLORS } from '../../helix-design-system'
import { Flex } from '../../primitives'
-import { ALIGN_CENTER, DIRECTION_ROW } from '../../styles'
+import { ALIGN_CENTER, DIRECTION_ROW, FLEX_MAX_CONTENT } from '../../styles'
import { RESPONSIVENESS, SPACING, TYPOGRAPHY } from '../../ui-style-constants'
import { Icon } from '../../icons'
import { LegacyStyledText } from '../StyledText'
@@ -19,6 +19,7 @@ export interface TagProps {
iconPosition?: 'left' | 'right'
/** Tagicon */
iconName?: IconName
+ shrinkToContent?: boolean
}
const defaultColors = {
@@ -42,11 +43,12 @@ const TAG_PROPS_BY_TYPE: Record<
}
export function Tag(props: TagProps): JSX.Element {
- const { iconName, type, text, iconPosition } = props
+ const { iconName, type, text, iconPosition, shrinkToContent = false } = props
const DEFAULT_CONTAINER_STYLE = css`
padding: ${SPACING.spacing2} ${SPACING.spacing8};
border-radius: ${BORDERS.borderRadius4};
+ width: ${shrinkToContent ? FLEX_MAX_CONTENT : 'none'};
@media ${RESPONSIVENESS.touchscreenMediaQuerySpecs} {
border-radius: ${BORDERS.borderRadius8};
padding: ${SPACING.spacing8} ${SPACING.spacing12};
diff --git a/protocol-designer/src/assets/localization/en/starting_deck_state.json b/protocol-designer/src/assets/localization/en/starting_deck_state.json
index fcf88c2866e..080aa23199d 100644
--- a/protocol-designer/src/assets/localization/en/starting_deck_state.json
+++ b/protocol-designer/src/assets/localization/en/starting_deck_state.json
@@ -13,7 +13,7 @@
"clear_labware": "Clear labware",
"clear_slot": "Clear slot",
"clear": "Clear",
- "command_click_to_multi_select": "Command + Click for multi-select",
+ "command_click_to_multi_select": "^/⌘ + click to select multiple",
"convert_gen1_to_gen2": "To convert engage heights from GEN1 to GEN2, divide your engage height by 2.",
"convert_gen2_to_gen1": "To convert engage heights from GEN2 to GEN1, multiply your engage height by 2.",
"custom": "Custom labware definitions",
@@ -48,7 +48,7 @@
"read_more_gen1_gen2": "Read more about the differences between GEN1 and GEN2 Magnetic Modules",
"rename_lab": "Rename labware",
"reservoir": "Reservoirs",
- "shift_click_to_select_all": "Shift + Click to select all",
+ "shift_click_to_select_range": "⇧ + click to select range",
"starting_deck_state": "Starting deck state",
"tc_slots_occupied_flex": "The Thermocycler needs slots A1 and B1. Slot A1 is occupied",
"tc_slots_occupied_ot2": "The Thermocycler needs slots 7, 8, 10, and 11. One or more of those slots is occupied",
diff --git a/protocol-designer/src/pages/Designer/ProtocolSteps/__tests__/ProtocolSteps.test.tsx b/protocol-designer/src/pages/Designer/ProtocolSteps/__tests__/ProtocolSteps.test.tsx
index f68928c3488..2ce91e03263 100644
--- a/protocol-designer/src/pages/Designer/ProtocolSteps/__tests__/ProtocolSteps.test.tsx
+++ b/protocol-designer/src/pages/Designer/ProtocolSteps/__tests__/ProtocolSteps.test.tsx
@@ -95,8 +95,8 @@ describe('ProtocolSteps', () => {
it('renders the hot keys display', () => {
render()
screen.getByText('Double-click to edit')
- screen.getByText('Shift + Click to select all')
- screen.getByText('Command + Click for multi-select')
+ screen.getByText('⇧ + click to select range')
+ screen.getByText('^/⌘ + click to select multiple')
})
it('renders the current step name', () => {
diff --git a/protocol-designer/src/pages/Designer/ProtocolSteps/index.tsx b/protocol-designer/src/pages/Designer/ProtocolSteps/index.tsx
index b5e5810c2da..687553f3dc6 100644
--- a/protocol-designer/src/pages/Designer/ProtocolSteps/index.tsx
+++ b/protocol-designer/src/pages/Designer/ProtocolSteps/index.tsx
@@ -3,7 +3,6 @@ import { useSelector } from 'react-redux'
import { useTranslation } from 'react-i18next'
import {
ALIGN_CENTER,
- Box,
COLORS,
DIRECTION_COLUMN,
Flex,
@@ -126,13 +125,29 @@ export function ProtocolSteps(): JSX.Element {
{enableHoyKeyDisplay ? (
-
-
-
-
-
-
-
+
+
+
+
+
) : null}
{formData == null && selectedSubstep ? (