Skip to content

Commit d202f45

Browse files
authored
feat: truncate long avatar names (#1792)
* feat: avatar length handling Signed-off-by: Adam Setch <[email protected]> * feat: avatar length handling Signed-off-by: Adam Setch <[email protected]> * feat: avatar length handling Signed-off-by: Adam Setch <[email protected]> * feat: avatar length handling Signed-off-by: Adam Setch <[email protected]> --------- Signed-off-by: Adam Setch <[email protected]>
1 parent ca265a0 commit d202f45

File tree

9 files changed

+1749
-1589
lines changed

9 files changed

+1749
-1589
lines changed

src/renderer/components/avatars/AvatarWithFallback.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type React from 'react';
22
import { useState } from 'react';
33

44
import { FeedPersonIcon, MarkGithubIcon } from '@primer/octicons-react';
5-
import { Avatar, Stack, Text } from '@primer/react';
5+
import { Avatar, Stack, Truncate } from '@primer/react';
66

77
import { type Link, Size } from '../../types';
88
import type { UserType } from '../../typesGitHub';
@@ -34,7 +34,6 @@ export const AvatarWithFallback: React.FC<IAvatarWithFallback> = ({
3434
align="center"
3535
gap="condensed"
3636
data-testid="avatar"
37-
className="truncate"
3837
>
3938
{!src || isBroken ? (
4039
isNonHuman ? (
@@ -52,10 +51,9 @@ export const AvatarWithFallback: React.FC<IAvatarWithFallback> = ({
5251
/>
5352
)}
5453
{name && (
55-
// TODO add truncation logic for long names
56-
<Text className="block truncate flex-shrink overflow-ellipsis">
54+
<Truncate title={name} inline maxWidth={280}>
5755
{name}
58-
</Text>
56+
</Truncate>
5957
)}
6058
</Stack>
6159
);

src/renderer/components/avatars/__snapshots__/AvatarWithFallback.test.tsx.snap

Lines changed: 60 additions & 40 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)