Skip to content

Commit

Permalink
fix(app): fix ODD simple style predefined location option margin
Browse files Browse the repository at this point in the history
  • Loading branch information
mjhuff committed Oct 31, 2024
1 parent ec7641c commit 666c7c1
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions app/src/organisms/DropTipWizardFlows/steps/ChooseLocation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ import {
import { BLOWOUT_SUCCESS, DROP_TIP_SUCCESS, DT_ROUTES } from '../constants'
import { DropTipFooterButtons } from '../shared'

import type { FlattenSimpleInterpolation } from 'styled-components'
import type { AddressableAreaName } from '@opentrons/shared-data'
import type {
DropTipModalStyle,
DropTipWizardContainerProps,
ValidDropTipBlowoutLocation,
} from '../types'
Expand Down Expand Up @@ -129,13 +131,7 @@ export function ChooseLocation({
}

return (
<Flex
css={
modalStyle === 'simple'
? CONTAINER_STYLE_SIMPLE
: CONTAINER_STYLE_INTERVENTION
}
>
<Flex css={buildContainerStyle(modalStyle, dropTipCommandLocations.length)}>
<Flex css={OPTION_CONTAINER_STYLE}>
<StyledText
oddStyle="level4HeaderSemiBold"
Expand Down Expand Up @@ -169,6 +165,17 @@ export function ChooseLocation({
)
}

// TODO(jh, 10-31-24): The numLocations logic is a hack to get around some unexpected ODD-specific CSS behavior in RadioButton.
// Investigate RadioButton ODD styling.
const buildContainerStyle = (
modalStyle: DropTipModalStyle,
numLocations: number
): FlattenSimpleInterpolation => {
return modalStyle === 'simple'
? containerStyleSimple(numLocations)
: CONTAINER_STYLE_INTERVENTION
}

const CONTAINER_STYLE_BASE = `
overflow: ${OVERFLOW_AUTO};
flex-direction: ${DIRECTION_COLUMN};
Expand All @@ -182,12 +189,14 @@ const CONTAINER_STYLE_INTERVENTION = css`
${CONTAINER_STYLE_BASE}
`

const CONTAINER_STYLE_SIMPLE = css`
const containerStyleSimple = (
numLocations: number
): FlattenSimpleInterpolation => css`
${CONTAINER_STYLE_BASE}
justify-content: ${JUSTIFY_SPACE_BETWEEN};
@media ${RESPONSIVENESS.touchscreenMediaQuerySpecs} {
height: 80%;
height: ${numLocations >= 4 ? '80%' : '100%'};
flex-grow: 0;
}
`
Expand Down

0 comments on commit 666c7c1

Please sign in to comment.