mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-14 06:40:50 +00:00
refactor(settings): share one heading frame across all settings pages
Teach SettingsSectionFrame an explicit title/subtitle mode alongside the slug-driven mode, and have the per-module settings pages (Vorsorge, Illness, Labs) delegate to it so every settings surface renders the same heading frame.
This commit is contained in:
1 parent
39505a5d35
commit
bfba92cb83
2 files changed
+66
-30
No files matched your search
@@ -3,21 +3,18 @@
|
||||
import type { ReactNode } from "react";
|
||||
|
||||
import { SettingsHubBackLink } from "@/components/settings/settings-hub-back-link";
|
||||
import { SettingsSectionFrame } from "@/components/settings/settings-section-frame";
|
||||
|
||||
/**
|
||||
* v1.18.6 (W8 / MOD-03) — heading frame for the per-module settings pages
|
||||
* (Vorsorge / Illness / Labs).
|
||||
*
|
||||
* FRAME-ADOPTION SEAM: a parallel phase is introducing a shared
|
||||
* `SettingsSectionFrame` primitive under `src/components/settings/*` (which
|
||||
* this phase must not edit). Until that lands, this renders the canonical
|
||||
* settings heading markup verbatim — `h1.text-2xl.font-bold.tracking-tight`
|
||||
* + `p.text-muted-foreground.text-sm` — so the three new pages already
|
||||
* conform to the standard and can be swapped to the shared frame at merge by
|
||||
* replacing this single wrapper. The back-link reuses the existing
|
||||
* `SettingsHubBackLink` (read-only import) so the pages have a consistent
|
||||
* "return to the hub" affordance even though they are not listed in the
|
||||
* settings-shell sidebar.
|
||||
* Delegates to the shared `SettingsSectionFrame` so every settings page — the
|
||||
* 19 shell sections and these three per-module pages — renders one identical
|
||||
* heading frame. These pages stay out of the slug registry (their static
|
||||
* routes win over `/settings/[section]`), so they drive the frame's explicit
|
||||
* title/subtitle mode and supply the "return to the module" back-link through
|
||||
* the frame's `topSlot`, which sits above the heading.
|
||||
*/
|
||||
export function ModuleSettingsFrame({
|
||||
title,
|
||||
@@ -34,13 +31,12 @@ export function ModuleSettingsFrame({
|
||||
children: ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<div className="space-y-6">
|
||||
<div className="space-y-1">
|
||||
<SettingsHubBackLink href={backHref} labelKey={backLabelKey} />
|
||||
<h1 className="text-2xl font-bold tracking-tight">{title}</h1>
|
||||
<p className="text-muted-foreground text-sm">{description}</p>
|
||||
</div>
|
||||
<SettingsSectionFrame
|
||||
title={title}
|
||||
subtitle={description}
|
||||
topSlot={<SettingsHubBackLink href={backHref} labelKey={backLabelKey} />}
|
||||
>
|
||||
{children}
|
||||
</div>
|
||||
</SettingsSectionFrame>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user