mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-16 07:13:29 +00:00
fix(insights): contain the mood trend card so its axis labels stop overflowing
The Trends row renders three mini-chart cards (blood pressure, weight,
mood). The mood card alone overflowed: its categorical y-axis ("Super
gut/Gut/Okay/...") and date x-axis paint inside a Card shell that runs
taller than the flat HealthChart minis beside it, so the x-axis date
labels bled past the fixed chart slot and overlapped the caption below.
Bound the overflow on the slot itself, without touching the chart
components:
- `overflow-hidden` clips anything the inner chart paints past the
180px envelope, so a stray axis label can never escape into the
caption row.
- `[--chart-height:120px]` drives both mini charts' internal band down
to a shared 120px (both honour `h-[var(--chart-height,140px)]`). The
mood card's full envelope — band + header chrome + axis labels — now
fits inside 180px, so all three tiles share one chart-band baseline.
Recharts and the chart tokens are untouched; the fix lives entirely on
the row's slot container.
This commit is contained in:
1 parent
32ce6dfa18
commit
a2dff85fb8
2 files changed
+42
-2
No files matched your search
@@ -128,6 +128,26 @@ describe("<TrendsRow>", () => {
|
||||
}
|
||||
});
|
||||
|
||||
it("bounds the chart slot so the mood card's axis labels stay contained (item I)", () => {
|
||||
// v1.11.4 item I — the mood mini chart is a `<Card>` (extra header
|
||||
// + padding chrome) wrapping a categorical y-axis + a date x-axis;
|
||||
// its tick labels used to bleed past the 180 px envelope and
|
||||
// overlap the caption below. The slot now (a) clips with
|
||||
// `overflow-hidden` so nothing escapes the envelope and (b) drives
|
||||
// both mini charts' internal band down to 120 px via
|
||||
// `[--chart-height:120px]` so the mood card's full envelope
|
||||
// (band + header + axis labels) fits inside 180 px and the three
|
||||
// tiles share one chart-band baseline.
|
||||
const html = render(<TrendsRow />);
|
||||
const slots =
|
||||
html.match(/data-slot="trends-row-chart-slot"[^>]*class="[^"]*"/g) ?? [];
|
||||
expect(slots.length).toBe(3);
|
||||
for (const slot of slots) {
|
||||
expect(slot).toMatch(/overflow-hidden/);
|
||||
expect(slot).toMatch(/\[--chart-height:120px\]/);
|
||||
}
|
||||
});
|
||||
|
||||
it("renders annotations when supplied", () => {
|
||||
const html = render(
|
||||
<TrendsRow
|
||||
|
||||
Reference in new issue
Block a user