Skip to content

Commit 4ea47b7

Browse files
authored
fix(shared): truncate company badge overflow (#5900)
1 parent 8be478b commit 4ea47b7

3 files changed

Lines changed: 14 additions & 9 deletions

File tree

AGENTS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,8 @@ pnpm --filter extension build:chrome # Build Chrome extension
196196

197197
**IMPORTANT**: For changed `.ts`/`.tsx` files, run `node ./scripts/typecheck-strict-changed.js` or the package's strict `tsc` command before finishing. Do not add context-specific props to shared primitives when the behavior can be scoped in the parent list/container.
198198

199+
**IMPORTANT**: For text truncation inside flex layouts, scope the ellipsis to the text element and make the nearest flex item shrinkable with `min-w-0` (and `flex-1` when it should consume remaining space). Do not rely on `truncate` on the whole row.
200+
199201
**IMPORTANT**: When changing SEO, gating, or noindex logic, preserve existing `undefined`/nullable behavior unless the requirement explicitly changes it, and verify field names against the typed GraphQL model instead of ticket prose.
200202

201203
## Where Should I Put This Code?

packages/shared/src/components/VerifiedCompanyUserBadge.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export const VerifiedCompanyUserBadge = ({
4747
side="bottom"
4848
className="text-center"
4949
>
50-
<div className="flex items-center justify-center gap-1">
50+
<div className="flex min-w-0 items-center justify-center gap-1">
5151
<ProfilePicture
5252
size={size}
5353
className="border border-border-subtlest-secondary"
@@ -59,8 +59,9 @@ export const VerifiedCompanyUserBadge = ({
5959
/>
6060
{showCompanyName && (
6161
<Typography
62-
type={companyNameTypography?.type}
62+
type={companyNameTypography?.type ?? TypographyType.Footnote}
6363
color={companyNameTypography?.color || TypographyColor.Secondary}
64+
truncate
6465
>
6566
{companies[0].name}
6667
</Typography>

packages/shared/src/components/cards/entity/UserEntityCard.tsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ const UserEntityCard = ({ user, className }: Props) => {
192192
dateFormat="MMM d. yyyy"
193193
/>
194194
</div>
195-
<div className="flex gap-2 truncate">
195+
<div className="flex min-w-0 gap-2">
196196
{!!user?.reputation && (
197197
<div className="rounded-8 border border-border-subtlest-tertiary px-2">
198198
<ReputationUserBadge
@@ -204,12 +204,14 @@ const UserEntityCard = ({ user, className }: Props) => {
204204
/>
205205
</div>
206206
)}
207-
<VerifiedCompanyUserBadge
208-
size={ProfileImageSize.Small}
209-
user={user}
210-
showCompanyName
211-
showVerified
212-
/>
207+
<div className="min-w-0 flex-1">
208+
<VerifiedCompanyUserBadge
209+
size={ProfileImageSize.Small}
210+
user={user}
211+
showCompanyName
212+
showVerified
213+
/>
214+
</div>
213215
</div>
214216
{bio && <EntityDescription copy={bio} length={100} />}
215217
</div>

0 commit comments

Comments
 (0)