Skip to content

Commit 7c2f269

Browse files
tassoevanggazzo
authored andcommitted
fix: Allow word wrap in Label (#61)
1 parent 2587ecf commit 7c2f269

File tree

5 files changed

+12
-12
lines changed

5 files changed

+12
-12
lines changed
Loading
Loading

packages/fuselage/.storybook/jest-results.json

+1-1
Large diffs are not rendered by default.

packages/fuselage/src/components/Label/index.js

+11-8
Original file line numberDiff line numberDiff line change
@@ -21,36 +21,38 @@ const Wrapper = styled.div`
2121
${ withText(textStyle) }
2222
2323
display: flex;
24-
25-
flex: 1 0 auto;
26-
27-
flex-flow: row nowrap;
24+
align-items: center;
2825
`;
2926

3027
const topPositioned = css`
3128
flex-flow: column nowrap;
3229
align-items: stretch;
3330
3431
& > ${ Wrapper } {
32+
flex: 1 0 auto;
3533
margin: 0 0 ${ spacing } 0;
3634
}
3735
`;
3836

3937
const startPositioned = css`
4038
flex-flow: row nowrap;
41-
align-items: center;
39+
align-items: flex-start;
4240
4341
& > ${ Wrapper } {
42+
flex: 1 0 0;
4443
margin: 0 ${ spacing } 0 0;
44+
align-self: stretch;
4545
}
4646
`;
4747

4848
const endPositioned = css`
4949
flex-flow: row-reverse nowrap;
50-
align-items: center;
50+
align-items: flex-start;
5151
5252
& > ${ Wrapper } {
53+
flex: 1 0 0;
5354
margin: 0 0 0 ${ spacing };
55+
align-self: stretch;
5456
}
5557
`;
5658

@@ -67,15 +69,14 @@ const Container = styled.label`
6769

6870
const withRequiredMark = css`
6971
&::before {
70-
content: '* ';
72+
content: '*\0a0';
7173
7274
color: ${ requiredMarkColor };
7375
}
7476
`;
7577

7678
const Text = styled.span`
7779
${ normalized }
78-
${ withTruncatedText }
7980
${ withSelectableText }
8081
8182
flex: 1 1 0;
@@ -94,6 +95,8 @@ const Error = styled.span`
9495
margin-left: ${ spacing };
9596
9697
color: ${ errorColor };
98+
99+
white-space: wrap;
97100
`;
98101

99102
const LabelContext = createContext(false);

packages/fuselage/src/components/Label/stories.js

-3
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,6 @@ storiesOf('Elements|Label', module)
5151
end: { position: 'end' },
5252
}}
5353
/>
54-
<TextSection>
55-
<h2>Label</h2>
56-
</TextSection>
5754
</Document>);
5855

5956
const props = createPropsFromKnobs({

0 commit comments

Comments
 (0)