import { type ReactNode } from "react";
import { MainHorizontallyCenteredContainer } from "~/components/layout/AppLayout";
import { cn } from "~/utils/cn";
import { Header2, Header3 } from "./Headers";
import { Paragraph } from "./Paragraph";
// A composable layout system for settings pages: a centered container holds
// sections; each section has a header (title/description/action over a divide)
// followed by rows. A row lays out a title + description on the left and an
// action (button/switch/select/status) on the right, separated by divides and
// spacing rather than bordered boxes.
//
// Everything that renders text accepts `ReactNode`, and every piece takes a
// `className` so callers can restyle without forking. For layouts the built-in
// props don't cover, pass `children` to a row/block for full control.
const rowSize = {
sm: "py-3",
md: "py-4",
} as const;
type RowSize = keyof typeof rowSize;
/** Page-level wrapper that centers content and sets the settings column width. */
export function SettingsContainer({
children,
className,
}: {
children: ReactNode;
className?: string;
}) {
return (
{children}
);
}
/** A group of related rows. Adds vertical spacing between sibling sections. */
export function SettingsSection({
children,
className,
}: {
children: ReactNode;
className?: string;
}) {
return (
{children}
);
}
/**
* Section (or sub-section) heading with an optional description and a
* right-aligned action, sitting above a bottom divide. Use `as="h3"` for a
* heading nested inside a section.
*/
export function SettingsHeader({
title,
description,
action,
as = "h2",
className,
}: {
title: ReactNode;
description?: ReactNode;
action?: ReactNode;
as?: "h2" | "h3";
className?: string;
}) {
const Heading = as === "h3" ? Header3 : Header2;
return (