Skip to content

Commit

Permalink
refactor(app): provide styles for InlineNotification
Browse files Browse the repository at this point in the history
It can be used on desktop too now, isn't that fancy

The br with display-none is a little gross, but it lets us keep the
horizontal style with text layout rules on ODD and have it on two lines
on desktop.
  • Loading branch information
sfoster1 committed Jun 21, 2024
1 parent 8af4908 commit b449094
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { InlineNotification } from '.'
import type { Story, Meta } from '@storybook/react'

export default {
title: 'ODD/Atoms/InlineNotification',
title: 'App/Atoms/InlineNotification',
argTypes: {
hug: {
control: {
Expand Down
38 changes: 30 additions & 8 deletions app/src/atoms/InlineNotification/index.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
import * as React from 'react'
import { css } from 'styled-components'
import {
ALIGN_CENTER,
BORDERS,
Box,
Btn,
COLORS,
DIRECTION_ROW,
Flex,
Icon,
JUSTIFY_SPACE_BETWEEN,
SPACING,
LegacyStyledText,
StyledText,
TYPOGRAPHY,
RESPONSIVENESS,
} from '@opentrons/components'

import type { IconProps, StyleProps } from '@opentrons/components'
Expand Down Expand Up @@ -64,8 +67,8 @@ export function InlineNotification(
const inlineNotificationProps = INLINE_NOTIFICATION_PROPS_BY_TYPE[type]
const iconProps = {
...inlineNotificationProps.icon,
size: '1.75rem',
color: INLINE_NOTIFICATION_PROPS_BY_TYPE[type].color,
size: '100%',
}
return (
<Flex
Expand All @@ -79,12 +82,22 @@ export function InlineNotification(
padding={`${SPACING.spacing12} ${SPACING.spacing16}`}
width={hug ? 'max-content' : '100%'}
>
<Icon {...iconProps} aria-label={`icon_${type}`} />
<Box
css={css`
width: ${SPACING.spacing16};
height: ${SPACING.spacing16};
@media ${RESPONSIVENESS.touchscreenMediaQuerySpecs} {
width: 1.75rem;
height: 1.75rem;
}
`}
>
<Icon {...iconProps} aria-label={`icon_${type}`} />
</Box>
<Flex flex="1" alignItems={ALIGN_CENTER}>
<LegacyStyledText
fontSize={TYPOGRAPHY.fontSize22}
fontWeight={TYPOGRAPHY.fontWeightRegular}
lineHeight={TYPOGRAPHY.lineHeight28}
<StyledText
oddStyle="bodyTextRegular"
desktopStyle="bodyDefaultRegular"
>
<span
css={`
Expand All @@ -93,8 +106,17 @@ export function InlineNotification(
>
{fullHeading}
</span>
{/* this break is because the desktop wants this on two lines, but also wants/

Check failure on line 109 in app/src/atoms/InlineNotification/index.tsx

View workflow job for this annotation

GitHub Actions / js checks

Expected space or tab before '*/' in comment

Check failure on line 109 in app/src/atoms/InlineNotification/index.tsx

View workflow job for this annotation

GitHub Actions / js checks

Expected space or tab before '*/' in comment
inline text layout on ODD. Soooo here you go*/}
<br
css={`
@media ${RESPONSIVENESS.touchscreenMediaQuerySpecs} {
display: none;
}
`}
/>
{message != null && fullmessage}
</LegacyStyledText>
</StyledText>
</Flex>
{onCloseClick && (
<Btn
Expand Down

0 comments on commit b449094

Please sign in to comment.