Skip to content

Commit 4f061f7

Browse files
authored
fix(app): fix intervention modal icon sizing (#16940)
1 parent eff74bc commit 4f061f7

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

app/src/molecules/InterventionModal/index.tsx

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import {
2323

2424
import { getIsOnDevice } from '/app/redux/config'
2525

26-
import type { IconName } from '@opentrons/components'
2726
import { ModalContentOneColSimpleButtons } from './ModalContentOneColSimpleButtons'
2827
import { TwoColumn } from './TwoColumn'
2928
import { OneColumn } from './OneColumn'
@@ -32,6 +31,10 @@ import { ModalContentMixed } from './ModalContentMixed'
3231
import { DescriptionContent } from './DescriptionContent'
3332
import { DeckMapContent } from './DeckMapContent'
3433
import { CategorizedStepContent } from './CategorizedStepContent'
34+
35+
import type { FlattenSimpleInterpolation } from 'styled-components'
36+
import type { IconName } from '@opentrons/components'
37+
3538
export {
3639
ModalContentOneColSimpleButtons,
3740
TwoColumn,
@@ -122,6 +125,8 @@ export interface InterventionModalProps {
122125
type?: ModalType
123126
/** optional icon name */
124127
iconName?: IconName | null | undefined
128+
/* Optional icon size override. */
129+
iconSize?: string
125130
/** modal contents */
126131
children: React.ReactNode
127132
}
@@ -133,6 +138,7 @@ export function InterventionModal({
133138
iconName,
134139
iconHeading,
135140
children,
141+
iconSize,
136142
}: InterventionModalProps): JSX.Element {
137143
const modalType = type ?? 'intervention-required'
138144
const headerColor =
@@ -166,7 +172,7 @@ export function InterventionModal({
166172
{titleHeading}
167173
<Flex alignItems={ALIGN_CENTER} onClick={iconHeadingOnClick}>
168174
{iconName != null ? (
169-
<Icon name={iconName} css={ICON_STYLE} />
175+
<Icon name={iconName} css={buildIconStyle(iconSize)} />
170176
) : null}
171177
{iconHeading != null ? iconHeading : null}
172178
</Flex>
@@ -178,9 +184,11 @@ export function InterventionModal({
178184
)
179185
}
180186

181-
const ICON_STYLE = css`
182-
width: ${SPACING.spacing32};
183-
height: ${SPACING.spacing32};
187+
const buildIconStyle = (
188+
iconSize: string | undefined
189+
): FlattenSimpleInterpolation => css`
190+
width: ${iconSize ?? SPACING.spacing16};
191+
height: ${iconSize ?? SPACING.spacing16};
184192
margin: ${SPACING.spacing4};
185193
cursor: ${CURSOR_POINTER};
186194

app/src/organisms/InterventionModal/index.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,20 +165,22 @@ export function InterventionModal({
165165
}
166166
})()
167167

168-
const { iconName, headerTitle, headerTitleOnDevice } = (() => {
168+
const { iconName, headerTitle, headerTitleOnDevice, iconSize } = (() => {
169169
switch (command.commandType) {
170170
case 'waitForResume':
171171
case 'pause':
172172
return {
173173
iconName: 'pause-circle' as IconName,
174174
headerTitle: t('pause_on', { robot_name: robotName }),
175175
headerTitleOnDevice: t('pause'),
176+
iconSize: SPACING.spacing32,
176177
}
177178
case 'moveLabware':
178179
return {
179180
iconName: 'move-xy-circle' as IconName,
180181
headerTitle: t('move_labware_on', { robot_name: robotName }),
181182
headerTitleOnDevice: t('move_labware'),
183+
iconSize: SPACING.spacing32,
182184
}
183185
default:
184186
console.warn(
@@ -189,6 +191,7 @@ export function InterventionModal({
189191
iconName: null,
190192
headerTitle: '',
191193
headerTitleOnDevice: '',
194+
iconSize: undefined,
192195
}
193196
}
194197
})()
@@ -228,6 +231,7 @@ export function InterventionModal({
228231
iconHeading={<LegacyStyledText as="h1">{headerTitle}</LegacyStyledText>}
229232
iconName={iconName}
230233
type="intervention-required"
234+
iconSize={iconSize}
231235
>
232236
<Box {...CONTENT_STYLE}>
233237
{childContent}

0 commit comments

Comments
 (0)