Add min-width: 0; to the Flex components
Signed-off-by: Charles de Dreuille <charles.dedreuille@gmail.com>
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/canon': patch
|
||||
---
|
||||
|
||||
Add min-width: 0; by default on every Flex components in Canon to help support truncated texts inside flex elements.
|
||||
@@ -186,6 +186,7 @@
|
||||
}
|
||||
|
||||
.canon-Flex {
|
||||
min-width: 0;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
.canon-Flex {
|
||||
min-width: 0;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
@@ -9410,6 +9410,7 @@
|
||||
}
|
||||
|
||||
.canon-Flex {
|
||||
min-width: 0;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import { Flex } from './Flex';
|
||||
import { Text } from '../Text';
|
||||
|
||||
const meta = {
|
||||
title: 'Layout/Flex',
|
||||
@@ -143,3 +144,24 @@ export const LargeGap: Story = {
|
||||
</Flex>
|
||||
),
|
||||
};
|
||||
|
||||
export const WithTextTruncate: Story = {
|
||||
render: () => (
|
||||
<Flex direction="row" gap="8">
|
||||
<Flex>
|
||||
<Text truncate>
|
||||
A man looks at a painting in a museum and says, “Brothers and sisters
|
||||
I have none, but that man's father is my father's son.” Who
|
||||
is in the painting?
|
||||
</Text>
|
||||
</Flex>
|
||||
<Flex>
|
||||
<Text truncate>
|
||||
A man looks at a painting in a museum and says, “Brothers and sisters
|
||||
I have none, but that man's father is my father's son.” Who
|
||||
is in the painting?
|
||||
</Text>
|
||||
</Flex>
|
||||
</Flex>
|
||||
),
|
||||
};
|
||||
|
||||
@@ -16,4 +16,7 @@
|
||||
|
||||
.canon-Flex {
|
||||
display: flex;
|
||||
|
||||
/* This helps when using `truncate` on text inside a flex container */
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user