Skip to content

Commit

Permalink
feat(app): update LegacyModalHeader for new designs (#15914)
Browse files Browse the repository at this point in the history
# Overview

Update `LegacyModalHeader` according to new designs to accept up to 2
elements ahead of title text.
Add props to `LegacyModal` that are passed down to header, and implement
at `LabwareStackRender`
<img width="532" alt="Screenshot 2024-08-07 at 11 57 09 AM"
src="https://github.com/user-attachments/assets/537f5a7c-b148-4641-b000-40da0d8da3ea">

Closes PLAT-395
  • Loading branch information
ncdiehl11 authored Aug 7, 2024
1 parent 45344f5 commit 09e3fa9
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
20 changes: 17 additions & 3 deletions app/src/molecules/LegacyModal/LegacyModalHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import {
Icon,
JUSTIFY_CENTER,
JUSTIFY_SPACE_BETWEEN,
SPACING,
LegacyStyledText,
SPACING,
TYPOGRAPHY,
} from '@opentrons/components'

Expand All @@ -19,6 +19,8 @@ import type { IconProps } from '@opentrons/components'
export interface LegacyModalHeaderProps {
onClose?: React.MouseEventHandler
title: React.ReactNode
titleElement1?: JSX.Element
titleElement2?: JSX.Element
backgroundColor?: string
color?: string
icon?: IconProps
Expand All @@ -44,7 +46,16 @@ const closeIconStyles = css`
export const LegacyModalHeader = (
props: LegacyModalHeaderProps
): JSX.Element => {
const { icon, onClose, title, backgroundColor, color, closeButton } = props
const {
icon,
onClose,
title,
titleElement1,
titleElement2,
backgroundColor,
color,
closeButton,
} = props
return (
<>
<Flex
Expand All @@ -55,8 +66,11 @@ export const LegacyModalHeader = (
backgroundColor={backgroundColor}
data-testid="Modal_header"
>
<Flex>
<Flex alignItems={ALIGN_CENTER} gridGap={SPACING.spacing8}>
{icon != null && <Icon {...icon} data-testid="Modal_header_icon" />}
{titleElement1}
{titleElement2}
{/* TODO (nd: 08/07/2024) Convert to StyledText once designs are resolved */}
<LegacyStyledText
as="h3"
fontWeight={TYPOGRAPHY.fontWeightSemiBold}
Expand Down
6 changes: 6 additions & 0 deletions app/src/molecules/LegacyModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ export interface LegacyModalProps extends StyleProps {
onClose?: React.MouseEventHandler
closeOnOutsideClick?: boolean
title?: React.ReactNode
titleElement1?: JSX.Element
titleElement2?: JSX.Element
fullPage?: boolean
childrenPadding?: string | number
children?: React.ReactNode
Expand All @@ -31,6 +33,8 @@ export const LegacyModal = (props: LegacyModalProps): JSX.Element => {
childrenPadding = `${SPACING.spacing16} ${SPACING.spacing24} ${SPACING.spacing24}`,
children,
footer,
titleElement1,
titleElement2,
...styleProps
} = props

Expand Down Expand Up @@ -58,6 +62,8 @@ export const LegacyModal = (props: LegacyModalProps): JSX.Element => {
<LegacyModalHeader
onClose={onClose}
title={title}
titleElement1={titleElement1}
titleElement2={titleElement2}
icon={['error', 'warning'].includes(type) ? modalIcon : undefined}
color={COLORS.black90}
backgroundColor={COLORS.white}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ export const LabwareStackModal = (
</Flex>
}
childrenPadding={0}
marginLeft="0"
>
<Box padding={SPACING.spacing24} backgroundColor={COLORS.white}>
<Flex flexDirection={DIRECTION_COLUMN}>
Expand Down

0 comments on commit 09e3fa9

Please sign in to comment.