Skip to content

Commit

Permalink
fix(app): fix csv filename wrapping (#16156)
Browse files Browse the repository at this point in the history
Wrap long CSV file names in `ChooseCsvFile` component to maintain style
of selection screen

Closes RQA-3003
  • Loading branch information
ncdiehl11 authored Sep 3, 2024
1 parent 933175f commit 2461723
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
1 change: 1 addition & 0 deletions app/src/atoms/buttons/RadioButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ export function RadioButton(props: RadioButtonProps): JSX.Element {
display: ${maxLines != null ? '-webkit-box' : undefined};
-webkit-line-clamp: ${maxLines ?? undefined};
-webkit-box-orient: ${maxLines != null ? 'vertical' : undefined};
word-wrap: break-word;
}
}
`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import type {
import type { CsvFileData } from '@opentrons/api-client'

const MAX_CHARS = 52
const CSV_FILENAME_BREAK_POINT = 46
const CSV_FILENAME_BREAK_POINT = 42
interface ChooseCsvFileProps {
protocolId: string
handleGoBack: () => void
Expand Down
13 changes: 12 additions & 1 deletion app/src/pages/ProtocolSetup/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ import {
Icon,
JUSTIFY_END,
JUSTIFY_SPACE_BETWEEN,
LegacyStyledText,
NO_WRAP,
OVERFLOW_WRAP_ANYWHERE,
POSITION_STICKY,
SPACING,
LegacyStyledText,
TEXT_ALIGN_RIGHT,
truncateString,
TYPOGRAPHY,
Expand Down Expand Up @@ -115,6 +116,8 @@ interface ProtocolSetupStepProps {
title: string
// first line of detail text
detail?: string | null
// clip detail text overflow with ellipsis
clipDetail?: boolean
// second line of detail text
subDetail?: string | null
// disallow click handler, disabled styling
Expand All @@ -140,6 +143,7 @@ export function ProtocolSetupStep({
detail,
subDetail,
disabled = false,
clipDetail = false,
interactionDisabled = false,
disabledReason,
description,
Expand Down Expand Up @@ -250,6 +254,7 @@ export function ProtocolSetupStep({
textAlign={TEXT_ALIGN_RIGHT}
color={interactionDisabled ? COLORS.grey50 : COLORS.black90}
maxWidth="20rem"
css={clipDetail ? CLIPPED_TEXT_STYLE : undefined}
>
{detail}
{subDetail != null && detail != null ? <br /> : null}
Expand Down Expand Up @@ -1075,3 +1080,9 @@ export function ProtocolSetup(): JSX.Element {
</>
)
}

const CLIPPED_TEXT_STYLE = css`
white-space: ${NO_WRAP};
overflow: hidden;
text-overflow: ellipsis;
`

0 comments on commit 2461723

Please sign in to comment.