Skip to content

Commit

Permalink
fix(protocol-designer): update line clamp style for title (#17309)
Browse files Browse the repository at this point in the history
* fix(protocol-designer): update line clamp style for title
  • Loading branch information
koji authored Jan 21, 2025
1 parent e837257 commit 1ba7b0f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
7 changes: 5 additions & 2 deletions protocol-designer/src/atoms/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,18 @@ export const LINK_BUTTON_STYLE = css`
`

export const LINE_CLAMP_TEXT_STYLE = (
lineClamp: number
lineClamp: number,
title?: boolean
): FlattenSimpleInterpolation => css`
display: -webkit-box;
-webkit-box-orient: vertical;
overflow: ${OVERFLOW_HIDDEN};
text-overflow: ellipsis;
word-wrap: break-word;
-webkit-line-clamp: ${lineClamp};
word-break: break-all; // for a non word case like aaaaaaaa
word-break: ${title === true
? 'normal'
: 'break-all'}; // normal for tile and break-all for a non word case like aaaaaaaa
`

const MIN_OVERVIEW_WIDTH = '64rem'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,8 @@ export function StepFormToolbox(props: StepFormToolboxProps): JSX.Element {
}
}

console.log('stepName', formData.stepName)

return (
<>
{isRename ? (
Expand Down Expand Up @@ -348,7 +350,7 @@ export function StepFormToolbox(props: StepFormToolboxProps): JSX.Element {
<Icon size="1rem" name={icon} minWidth="1rem" />
<StyledText
desktopStyle="bodyLargeSemiBold"
css={LINE_CLAMP_TEXT_STYLE(2)}
css={LINE_CLAMP_TEXT_STYLE(2, true)}
>
{capitalizeFirstLetter(String(formData.stepName))}
</StyledText>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import difference from 'lodash/difference'
import isEqual from 'lodash/isEqual'
import without from 'lodash/without'
import startCase from 'lodash/startCase'
import {
SOURCE_WELL_BLOWOUT_DESTINATION,
DEST_WELL_BLOWOUT_DESTINATION,
Expand Down Expand Up @@ -338,6 +339,9 @@ export const getSaveStepSnackbarText = (
}

export const capitalizeFirstLetter = (stepName: string): string => {
// Note - this is a special case
if (stepName === 'absorbance plate reader') return startCase(stepName)

// Note - check is for heater-shaker
if (stepName.includes('-')) {
return stepName
Expand Down

0 comments on commit 1ba7b0f

Please sign in to comment.