Skip to content

Commit b3f97dc

Browse files
authored
Merge pull request #74 from input-output-hk/fix/lw-12306-truncate-profile-dropdown-trigger-title
fix: truncate profile dropdown trigger title [LW-12306]
2 parents 3302145 + 0b1f07f commit b3f97dc

File tree

3 files changed

+33
-8
lines changed

3 files changed

+33
-8
lines changed

src/design-system/profile-dropdown/profile-dropdown-trigger.component.tsx

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,16 @@ export const Trigger = ({
4848
className={classNames(cx.button, cx.container, className)}
4949
data-testid={makeTestId(id)}
5050
>
51-
<Flex alignItems="center">
52-
<WalletCard
53-
profile={profile}
54-
title={{ text: title, type: 'button' }}
55-
subtitle={subtitle}
56-
type={type}
57-
testId={makeTestId(id)}
58-
/>
51+
<Flex alignItems="center" w="$fill">
52+
<Box className={cx.walletcard}>
53+
<WalletCard
54+
profile={profile}
55+
title={{ text: title, type: 'button' }}
56+
subtitle={subtitle}
57+
type={type}
58+
testId={makeTestId(id)}
59+
/>
60+
</Box>
5961

6062
<Box ml="$10">
6163
<Flex w="$16" h="$16" alignItems="center" justifyContent="center">

src/design-system/profile-dropdown/profile-dropdown-trigger.css.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ import { sx, style, vars } from '../../design-tokens';
22

33
export const button = style({});
44

5+
export const walletcard = style({
6+
flex: '1', // make sure the title etc uses all available space
7+
minWidth: 0, // make sure it doesn't overflow width
8+
});
9+
510
export const container = style([
611
sx({
712
height: '$48',

src/design-system/profile-dropdown/profile-dropdown-trigger.stories.tsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,24 @@ export const Overview = (): JSX.Element => (
8888
}}
8989
/>
9090
</Flex>
91+
<Flex
92+
gap="$16"
93+
alignItems="center"
94+
w="$fill"
95+
justifyContent="center"
96+
mt="$16"
97+
>
98+
<Trigger
99+
title="TRIGGER_WITH_LONG_WALLET_NAME_THAT_SHOULD_BE_TRUNCATED"
100+
type="hot"
101+
style={{ width: '200px' }}
102+
/>
103+
<Trigger
104+
title="TRIGGER_WITH_LONG_WALLET_NAME_THAT_SHOULD_BE_TRUNCATED"
105+
type="hot"
106+
style={{ width: '400px' }}
107+
/>
108+
</Flex>
91109
</Section>
92110

93111
<Divider my="$64" />

0 commit comments

Comments
 (0)