mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-17 07:42:23 +00:00
fix(dashboard): stack briefing-row headline over delta on phone widths
A long signal headline beside a wide delta string squeezed the headline into a one-word-per-line column on the hero spotlight rows; at 360 px the delta pushed past the tile edge and got cut off by the band's overflow clip. Below sm the headline/delta pair now stacks — headline wraps at full row width, the delta sits beneath as a left-aligned tone-coloured line — and the side-by-side row returns at sm+. Same treatment on the /insights briefing card's shared finding/signal rows, which speak the identical row language.
This commit is contained in:
1 parent
0da11811e2
commit
39034afcdc
4 files changed
+61
-4
No files matched your search
@@ -102,6 +102,20 @@ describe("<DailyBriefing>", () => {
|
||||
expect(html).toContain("+6 mmHg");
|
||||
});
|
||||
|
||||
it("stacks headline over delta below sm and keeps the row at sm+", () => {
|
||||
const html = render(<DailyBriefing briefing={baseBriefing} />);
|
||||
// Phone-first column (headline above, delta beneath), side-by-side
|
||||
// restored at sm+ — a wide delta must never squeeze the headline
|
||||
// into a narrow multi-line column.
|
||||
expect(html).toMatch(
|
||||
/class="flex flex-col gap-1 sm:flex-row sm:items-start sm:justify-between sm:gap-3"/,
|
||||
);
|
||||
// Delta badge stays content-width + left-aligned in the stacked state.
|
||||
expect(html).toMatch(
|
||||
/data-slot="daily-briefing-delta"[^>]*class="[^"]*self-start[^"]*sm:shrink-0[^"]*"/,
|
||||
);
|
||||
});
|
||||
|
||||
it("does NOT render a delta badge when delta is null", () => {
|
||||
const html = render(
|
||||
<DailyBriefing
|
||||
|
||||
@@ -197,7 +197,9 @@ function DeltaBadge({
|
||||
<span
|
||||
data-slot="daily-briefing-delta"
|
||||
className={cn(
|
||||
"text-xs font-semibold tabular-nums",
|
||||
// `self-start` keeps the badge left-aligned + content-width when
|
||||
// the parent row stacks into a column below `sm`.
|
||||
"self-start text-xs font-semibold tabular-nums sm:shrink-0",
|
||||
TONE_TEXT_CLASSNAME[tone],
|
||||
)}
|
||||
>
|
||||
@@ -243,7 +245,11 @@ function BriefingRow({
|
||||
aria-hidden="true"
|
||||
/>
|
||||
<div className="min-w-0 flex-1 space-y-1">
|
||||
<div className="flex items-start justify-between gap-3">
|
||||
{/* Phone widths stack headline over delta (same treatment as the
|
||||
dashboard spotlight rows): side-by-side squeezed a long
|
||||
headline into a narrow multi-line column beside a long delta.
|
||||
At `sm+` the row layout returns. */}
|
||||
<div className="flex flex-col gap-1 sm:flex-row sm:items-start sm:justify-between sm:gap-3">
|
||||
<p className="text-sm leading-snug font-medium">
|
||||
{stripChartTokens(headline)}
|
||||
</p>
|
||||
|
||||
Reference in new issue
Block a user