Skip to content

Commit

Permalink
Text, Heading: Ensure maxLines truncates correctly in flex container (
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeltaranto authored Sep 18, 2024
1 parent fe87543 commit c2161e5
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .changeset/hungry-ads-cheer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
'braid-design-system': patch
---

---
updated:
- Text
- Heading
---

**Text, Heading:** Ensure `maxLines` truncates correctly when used as the direct child of a flex container.
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,18 @@ export const screenshots: ComponentScreenshot = {
</Box>
),
},
{
label: 'Max lines = 1 (in flex container, should be same as truncation)',
Example: () => (
<Box display="flex" flexDirection="column" style={{ width: 220 }}>
<Box style={{ border: '1px solid red' }} />
<Heading level="2" maxLines={1}>
Limiting to 1 line that won’t fit in the layout
</Heading>
<Box style={{ border: '1px solid red' }} />
</Box>
),
},
{
label: 'Max lines = 3',
Example: () => (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,16 @@ export const screenshots: ComponentScreenshot = {
</Box>
),
},
{
label: 'Max lines = 1 (in flex container, should be same as truncation)',
Example: () => (
<Box display="flex" style={{ width: 215 }}>
<Text maxLines={1}>
Text limited to 1 line that won’t fit in the layout
</Text>
</Box>
),
},
{
label: 'Max lines = 3',
Example: () => (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ export const Typography = ({
className,
isTruncated ? descenderCropFixForWebkitBox : undefined,
]}
minWidth={isTruncated ? 0 : undefined}
{...buildDataAttributes({ data, validateRestProps: restProps })}
>
{icon ? (
Expand Down

0 comments on commit c2161e5

Please sign in to comment.