Name pill shows the full name on phones, wraps when long
The pill was capped at a percentage of the bubble column and clipped with an ellipsis; a short bubble's column is narrower than its own name, so names read as "E..." and "V...". It is now max-content up to a viewport-based cap and wraps. Demo fixtures gain a long display name to keep this honest. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
58df7b833c
commit
8ac43bd73f
2 changed files with 10 additions and 6 deletions
|
|
@ -209,12 +209,13 @@ export const BubbleHeaderPose = style({
|
|||
padding: `0 ${toRem(13)}`,
|
||||
background: color.Secondary.Container,
|
||||
border: `1px solid ${color.Secondary.ContainerLine}`,
|
||||
borderRadius: toRem(999),
|
||||
whiteSpace: 'nowrap',
|
||||
// Never wider than the bubble minus the portrait, so it cannot reach the portrait's face.
|
||||
maxWidth: `calc(100% - ${PHONE_PORTRAIT} - ${toRem(30)})`,
|
||||
overflow: 'hidden',
|
||||
textOverflow: 'ellipsis',
|
||||
// The pill is as wide as the full name needs, up to the room beside the portrait, then the
|
||||
// name wraps. It is capped by the viewport, not by the column: a short bubble's column is
|
||||
// narrower than its own name, and a percentage cap there truncated names to one letter.
|
||||
width: 'max-content',
|
||||
maxWidth: `calc(100vw - ${PHONE_PORTRAIT} - ${toRem(64)})`,
|
||||
overflowWrap: 'anywhere',
|
||||
borderRadius: toRem(14),
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ export const USERS: DemoUser[] = [
|
|||
{ id: `@void:${DEMO_SERVER}`, name: 'Void' },
|
||||
{ id: `@nibu:${DEMO_SERVER}`, name: 'Nibu' },
|
||||
{ id: `@visitor:${DEMO_SERVER}`, name: 'Visitor' },
|
||||
{ id: `@watch:${DEMO_SERVER}`, name: 'Heimdall of the Long Watch, Keeper of the Bridge' },
|
||||
];
|
||||
const user = (localpart: string) => `@${localpart}:${DEMO_SERVER}`;
|
||||
|
||||
|
|
@ -110,6 +111,8 @@ export const ROOMS: DemoRoom[] = [
|
|||
pose: 'deadpan',
|
||||
minutesAgo: 25,
|
||||
},
|
||||
// A long display name: the name pill has to show all of it on a phone.
|
||||
{ from: user('watch'), body: 'Ok.', pose: 'reading', minutesAgo: 20 },
|
||||
],
|
||||
},
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue