Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(app, components) fix csv name wrapping issue #16785

Merged
merged 3 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import {
DIRECTION_ROW,
Flex,
LegacyStyledText,
SPACING,
RadioButton,
SPACING,
truncateString,
TYPOGRAPHY,
} from '@opentrons/components'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,6 @@ export function ProtocolSetupParameters({
</>
)

// ToDo (kk:06/18/2024) ff will be removed when we freeze the code
if (chooseCsvFileScreen != null) {
children = (
<ChooseCsvFile
Expand Down
21 changes: 13 additions & 8 deletions app/src/organisms/ODD/ProtocolSetup/ProtocolSetupStep/index.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
import { css } from 'styled-components'
import {
Btn,
Flex,
Icon,
ALIGN_CENTER,
BORDERS,
Btn,
COLORS,
DIRECTION_COLUMN,
SPACING,
Flex,
Icon,
JUSTIFY_END,
LegacyStyledText,
NO_WRAP,
SPACING,
TEXT_ALIGN_RIGHT,
COLORS,
truncateString,
TYPOGRAPHY,
NO_WRAP,
LegacyStyledText,
} from '@opentrons/components'
import { useToaster } from '../../../ToasterOven'

const CSV_FILE_MAX_LENGTH = 18 // truncated text + three dots

export type ProtocolSetupStepStatus =
| 'ready'
| 'not ready'
Expand Down Expand Up @@ -167,7 +170,9 @@ export function ProtocolSetupStep({
maxWidth="20rem"
css={clipDetail ? CLIPPED_TEXT_STYLE : undefined}
>
{detail}
{title === 'CSV File' && detail != null
? truncateString(detail, CSV_FILE_MAX_LENGTH)
: detail}
{subDetail != null && detail != null ? <br /> : null}
{subDetail}
</LegacyStyledText>
Expand Down
6 changes: 4 additions & 2 deletions components/src/atoms/buttons/RadioButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
SPACING,
StyledText,
} from '../..'

import type { IconName } from '../..'
import type { StyleProps } from '../../primitives'

Expand All @@ -28,7 +29,7 @@ interface RadioButtonProps extends StyleProps {
radioButtonType?: 'large' | 'small'
subButtonLabel?: string
id?: string
maxLines?: number | null
maxLines?: number
// used for mouseEnter and mouseLeave
setNoHover?: () => void
setHovered?: () => void
Expand All @@ -51,7 +52,7 @@ export function RadioButton(props: RadioButtonProps): JSX.Element {
: `RadioButtonId_${buttonValue}`,
largeDesktopBorderRadius = false,
iconName,
maxLines = null,
maxLines = 1,
setHovered,
setNoHover,
} = props
Expand Down Expand Up @@ -118,6 +119,7 @@ export function RadioButton(props: RadioButtonProps): JSX.Element {
-webkit-line-clamp: ${maxLines ?? undefined};
-webkit-box-orient: ${maxLines != null ? 'vertical' : undefined};
word-wrap: break-word;
word-break: break-all;
}
`

Expand Down
Loading