From 18e950bbf7f06da771721d524131e95499c0183d Mon Sep 17 00:00:00 2001 From: jay Date: Mon, 22 Jun 2026 13:20:32 -0400 Subject: [PATCH] home3 news headline: drop JS char-slice, use CSS line-clamp:2 (word-boundary, fills 2 lines) Co-Authored-By: Claude Opus 4.8 --- frontend/src/routes/home3/+page.svelte | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/frontend/src/routes/home3/+page.svelte b/frontend/src/routes/home3/+page.svelte index 62c1390..1e6baae 100644 --- a/frontend/src/routes/home3/+page.svelte +++ b/frontend/src/routes/home3/+page.svelte @@ -9,14 +9,8 @@ let art = $state(null); // {title, artist, year, image} let newsFit = $state('cover'); // 'cover' = full-bleed photo; 'contain' = framed-plate figure - // headline truncated on a whole-word boundary (no mid-word ellipsis) - function clampWords(s, max = 48) { - if (!s || s.length <= max) return s; - const cut = s.slice(0, max); - const i = cut.lastIndexOf(' '); - return (i > 0 ? cut.slice(0, i) : cut).replace(/[\s,;:.]+$/, '') + '…'; - } - let headline = $derived(clampWords(news?.title ?? 'What went right this week: the good news that actually matters')); + // truncation handled by CSS (-webkit-line-clamp:2) — breaks on whole words, fills 2 full lines + let headline = $derived(news?.title ?? 'What went right this week: the good news that actually matters'); // small-joys shelf: 3 cells shown two at a time, rotated by the reader (no auto-motion) const JOY_ACCENTS = ['#4f7da8', '#b06a86', '#b06a45'];