Skip to content

Commit 3fa3067

Browse files
committed
style: replace hard JS character truncation with CSS line-clamp on hero risk bullet
Risk bullet text in HeroOpportunityBullets now wraps naturally up to 2 lines using CSS line-clamp-2 instead of cutting at 77 characters mid-word. Full text is available on hover via title attribute.
1 parent 2940967 commit 3fa3067

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

β€Žapps/desktop/src/features/dashboard/components/HeroOpportunityBullets.tsxβ€Ž

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export function HeroOpportunityBullets({
3535
bullets.push({
3636
key: "main-risk",
3737
color: "bg-amber-500",
38-
text: mainRisk.length > 80 ? mainRisk.slice(0, 77) + "..." : mainRisk,
38+
text: mainRisk,
3939
isRisk: true,
4040
});
4141
}
@@ -57,7 +57,10 @@ export function HeroOpportunityBullets({
5757
className={`mt-[7px] block size-1.5 shrink-0 rounded-full ${bullet.color}`}
5858
/>
5959
)}
60-
<span className="text-[13px] leading-snug text-zinc-600 dark:text-zinc-400">
60+
<span
61+
className={`text-[13px] leading-snug text-zinc-600 dark:text-zinc-400${bullet.isRisk ? " line-clamp-2" : ""}`}
62+
title={bullet.text}
63+
>
6164
{bullet.text}
6265
</span>
6366
</li>

β€Žtest/ui/dashboard-company-understanding-hero.test.tsβ€Ž

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,22 @@ describe("HeroOpportunityBullets", () => {
191191
const src = readSrc("components/HeroOpportunityBullets.tsx");
192192
expect(src).toContain("if (bullets.length === 0) return null");
193193
});
194+
195+
it("does not use JS character truncation on risk text", () => {
196+
const src = readSrc("components/HeroOpportunityBullets.tsx");
197+
expect(src).not.toContain(".slice(0, 77)");
198+
expect(src).not.toContain('+ "..."');
199+
});
200+
201+
it("uses CSS line-clamp-2 for risk bullet text", () => {
202+
const src = readSrc("components/HeroOpportunityBullets.tsx");
203+
expect(src).toContain("line-clamp-2");
204+
});
205+
206+
it("provides full text via title attribute for hover tooltip", () => {
207+
const src = readSrc("components/HeroOpportunityBullets.tsx");
208+
expect(src).toContain("title={bullet.text}");
209+
});
194210
});
195211

196212
// ═══════════════════════════════════════════════════════

0 commit comments

Comments
Β (0)