Skip to content

Commit e2bc455

Browse files
authored
fix(protocol-designer): fix empty selector button size issue (#17418)
* fix(protocol-designer): fix empty selector button size issue
1 parent e37b61f commit e2bc455

File tree

6 files changed

+94
-73
lines changed

6 files changed

+94
-73
lines changed

protocol-designer/src/organisms/EditInstrumentsModal/PipetteOverview.tsx

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
DIRECTION_COLUMN,
1010
DIRECTION_ROW,
1111
EmptySelectorButton,
12+
FLEX_MAX_CONTENT,
1213
Flex,
1314
Icon,
1415
JUSTIFY_SPACE_BETWEEN,
@@ -179,15 +180,17 @@ export function PipetteOverview({
179180
) : null}
180181
{has96Channel ||
181182
(leftPipette != null && rightPipette != null) ? null : (
182-
<EmptySelectorButton
183-
onClick={() => {
184-
setPage('add')
185-
setMount(targetPipetteMount)
186-
}}
187-
text={t('add_pipette')}
188-
textAlignment="left"
189-
iconName="plus"
190-
/>
183+
<Flex width={FLEX_MAX_CONTENT}>
184+
<EmptySelectorButton
185+
onClick={() => {
186+
setPage('add')
187+
setMount(targetPipetteMount)
188+
}}
189+
text={t('add_pipette')}
190+
textAlignment="left"
191+
iconName="plus"
192+
/>
193+
</Flex>
191194
)}
192195
</Flex>
193196
</Flex>
@@ -238,14 +241,16 @@ export function PipetteOverview({
238241
</Flex>
239242
</ListItem>
240243
) : (
241-
<EmptySelectorButton
242-
onClick={() => {
243-
dispatch(toggleIsGripperRequired())
244-
}}
245-
text={t('protocol_overview:add_gripper')}
246-
textAlignment="left"
247-
iconName="plus"
248-
/>
244+
<Flex width={FLEX_MAX_CONTENT}>
245+
<EmptySelectorButton
246+
onClick={() => {
247+
dispatch(toggleIsGripperRequired())
248+
}}
249+
text={t('protocol_overview:add_gripper')}
250+
textAlignment="left"
251+
iconName="plus"
252+
/>
253+
</Flex>
249254
)}
250255
</Flex>
251256
</Flex>

protocol-designer/src/pages/CreateNewProtocolWizard/SelectFixtures.tsx

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
DIRECTION_COLUMN,
99
EmptySelectorButton,
1010
Flex,
11+
FLEX_MAX_CONTENT,
1112
ListItem,
1213
SPACING,
1314
StyledText,
@@ -99,23 +100,24 @@ export function SelectFixtures(props: WizardTileProps): JSX.Element | null {
99100
)
100101

101102
return (
102-
<EmptySelectorButton
103-
disabled={numSlotsAvailable === 0}
104-
key={equipment}
105-
textAlignment={TYPOGRAPHY.textAlignLeft}
106-
iconName="plus"
107-
text={t(`${equipment}`)}
108-
onClick={() => {
109-
if (numSlotsAvailable === 0) {
110-
makeSnackbar(t('slots_limit_reached') as string)
111-
} else {
112-
setValue('additionalEquipment', [
113-
...additionalEquipment,
114-
equipment,
115-
])
116-
}
117-
}}
118-
/>
103+
<Flex width={FLEX_MAX_CONTENT} key={equipment}>
104+
<EmptySelectorButton
105+
disabled={numSlotsAvailable === 0}
106+
textAlignment={TYPOGRAPHY.textAlignLeft}
107+
iconName="plus"
108+
text={t(`${equipment}`)}
109+
onClick={() => {
110+
if (numSlotsAvailable === 0) {
111+
makeSnackbar(t('slots_limit_reached') as string)
112+
} else {
113+
setValue('additionalEquipment', [
114+
...additionalEquipment,
115+
equipment,
116+
])
117+
}
118+
}}
119+
/>
120+
</Flex>
119121
)
120122
})}
121123
</Flex>

protocol-designer/src/pages/CreateNewProtocolWizard/SelectModules.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
COLORS,
66
DIRECTION_COLUMN,
77
EmptySelectorButton,
8+
FLEX_MAX_CONTENT,
89
Flex,
910
ListItem,
1011
SPACING,
@@ -320,7 +321,7 @@ function AddModuleEmptySelectorButton(
320321

321322
return (
322323
<>
323-
<Flex {...targetProps}>
324+
<Flex {...targetProps} width={FLEX_MAX_CONTENT}>
324325
<EmptySelectorButton
325326
disabled={!areSlotsAvailable || disableGripperRequired}
326327
textAlignment={TYPOGRAPHY.textAlignLeft}

protocol-designer/src/pages/CreateNewProtocolWizard/SelectPipettes.tsx

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import {
2121
DISPLAY_FLEX,
2222
DISPLAY_INLINE_BLOCK,
2323
EmptySelectorButton,
24+
FLEX_MAX_CONTENT,
2425
Flex,
2526
Icon,
2627
JUSTIFY_SPACE_BETWEEN,
@@ -554,16 +555,18 @@ export function SelectPipettes(props: WizardTileProps): JSX.Element | null {
554555
pipettesByMount.right.pipetteName != null &&
555556
pipettesByMount.left.tiprackDefURI != null &&
556557
pipettesByMount.right.tiprackDefURI != null) ? null : (
557-
<EmptySelectorButton
558-
onClick={() => {
559-
setPage('add')
560-
setMount(targetPipetteMount)
561-
resetFields()
562-
}}
563-
text={t('add_pipette')}
564-
textAlignment="left"
565-
iconName="plus"
566-
/>
558+
<Flex width={FLEX_MAX_CONTENT}>
559+
<EmptySelectorButton
560+
onClick={() => {
561+
setPage('add')
562+
setMount(targetPipetteMount)
563+
resetFields()
564+
}}
565+
text={t('add_pipette')}
566+
textAlignment="left"
567+
iconName="plus"
568+
/>
569+
</Flex>
567570
)}
568571
</>
569572
</Flex>

protocol-designer/src/pages/Designer/ProtocolSteps/StepForm/StepTools/AbsorbanceReaderTools/Initialization.tsx

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
Divider,
1111
DropdownMenu,
1212
EmptySelectorButton,
13+
FLEX_MAX_CONTENT,
1314
Flex,
1415
Icon,
1516
InputField,
@@ -237,12 +238,14 @@ function IntializationEditor(props: InitializationEditorProps): JSX.Element {
237238
{wavelengthItems}
238239
</Flex>
239240
{mode === 'multi' && wavelengths.length < MAX_WAVELENGTHS ? (
240-
<EmptySelectorButton
241-
onClick={handleAddWavelength}
242-
text={t('step_edit_form.absorbanceReader.add_wavelength.label')}
243-
textAlignment="left"
244-
disabled={numWavelengths === MAX_WAVELENGTHS}
245-
/>
241+
<Flex width={FLEX_MAX_CONTENT}>
242+
<EmptySelectorButton
243+
onClick={handleAddWavelength}
244+
text={t('step_edit_form.absorbanceReader.add_wavelength.label')}
245+
textAlignment="left"
246+
disabled={numWavelengths === MAX_WAVELENGTHS}
247+
/>
248+
</Flex>
246249
) : null}
247250
</Flex>
248251
{mode === 'single' ? (

protocol-designer/src/pages/Designer/ProtocolSteps/StepForm/StepTools/ThermocyclerTools/ThermocyclerProfileModal.tsx

Lines changed: 29 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { useTranslation } from 'react-i18next'
33
import {
44
DIRECTION_COLUMN,
55
EmptySelectorButton,
6+
FLEX_MAX_CONTENT,
67
Flex,
78
InfoScreen,
89
JUSTIFY_FLEX_END,
@@ -98,28 +99,34 @@ export function ThermocyclerProfileModal(
9899
maxHeight="31.875rem"
99100
>
100101
<Flex justifyContent={JUSTIFY_FLEX_END} gridGap={SPACING.spacing4}>
101-
<EmptySelectorButton
102-
text={t('form:step_edit_form.field.thermocyclerProfile.add_cycle')}
103-
onClick={() => {
104-
if (canAddStepOrProfile) {
105-
setShowCreateNewCycle(true)
106-
}
107-
}}
108-
textAlignment="left"
109-
iconName="plus"
110-
disabled={!canAddStepOrProfile}
111-
/>
112-
<EmptySelectorButton
113-
text={t('form:step_edit_form.field.thermocyclerProfile.add_step')}
114-
onClick={() => {
115-
if (canAddStepOrProfile) {
116-
setShowCreateNewStep(true)
117-
}
118-
}}
119-
textAlignment="left"
120-
iconName="plus"
121-
disabled={!canAddStepOrProfile}
122-
/>
102+
<Flex width={FLEX_MAX_CONTENT}>
103+
<EmptySelectorButton
104+
text={t(
105+
'form:step_edit_form.field.thermocyclerProfile.add_cycle'
106+
)}
107+
onClick={() => {
108+
if (canAddStepOrProfile) {
109+
setShowCreateNewCycle(true)
110+
}
111+
}}
112+
textAlignment="left"
113+
iconName="plus"
114+
disabled={!canAddStepOrProfile}
115+
/>
116+
</Flex>
117+
<Flex width={FLEX_MAX_CONTENT}>
118+
<EmptySelectorButton
119+
text={t('form:step_edit_form.field.thermocyclerProfile.add_step')}
120+
onClick={() => {
121+
if (canAddStepOrProfile) {
122+
setShowCreateNewStep(true)
123+
}
124+
}}
125+
textAlignment="left"
126+
iconName="plus"
127+
disabled={!canAddStepOrProfile}
128+
/>
129+
</Flex>
123130
</Flex>
124131
{steps.length > 0 || showCreateNewStep || showCreateNewCycle ? (
125132
<Flex

0 commit comments

Comments
 (0)