import * as React from "react"; import { Card } from "@/components/ui/card"; import { cn } from "@/lib/utils"; /** * `` — the standard Settings card container. * * Every Settings section paints the same bordered surface: a rounded card * with the app's one card-padding contract (`p-4 md:p-6` — 16 px on phones, * 24 px from `md` up). Before this primitive the surface hand-rolled * `bg-card border-border rounded-xl border p-4 sm:p-6` in ~35 files, which * (a) bypassed the `` primitive entirely and (b) stepped padding at * `sm:` (640 px) instead of `md:` (768 px), so on a ~700 px tablet Settings * cards read denser than every other surface. * * The default renders the ui `` so the surface composes from one shape. * Unlike the bare `` it does NOT impose the `flex flex-col gap` layout: * Settings card bodies own their internal rhythm (`SettingsCardHeader` + * `mt-4`/`space-y-*` bodies), so the container only owns the border, radius, * background, and padding. Pass `className` for per-card extras * (`scroll-mt-28`, `space-y-4`, `flex h-full flex-col`, …). * * `as="section"` keeps a card's semantic landmark element (a `
` with * an `aria-labelledby`) while painting the same shape and padding contract. */ const SETTINGS_CARD_SHELL = "block gap-0 p-4 md:p-6"; type SettingsCardOwnProps = { className?: string }; type SettingsCardProps = SettingsCardOwnProps & { as?: E; } & Omit, keyof SettingsCardOwnProps | "as">; export function SettingsCard({ as, className, ...props }: SettingsCardProps) { if (as) { const Component = as as React.ElementType; return ( -backed one. className={cn( "bg-card text-card-foreground rounded-xl border p-4 shadow-sm md:p-6", className, )} {...props} /> ); } return ( )} /> ); }