All files / src/components/auth auth-shell.tsx

100% Statements 1/1
100% Branches 4/4
100% Functions 1/1
100% Lines 1/1

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76                                                                                        285x                                                              
/**
 * AuthShell — the ruled frame every guest page shares.
 *
 * The five guest pages (sign in / sign up, forgot and reset password, verify
 * email, accept invitation, accept terms) are the one place in the portal
 * where the type ramp is allowed above the 1.375rem page-title cap: there is
 * no shell yet, one statement owns the screen, and the mockups reserve the
 * Display ramp for exactly this and for empty states
 * (`.context/mockups/_README.md`, rule 5).
 *
 * The frame is therefore: the brand line, a Display heading, one lead line,
 * and THE page rule — the single hairline carrying the 3px index-red inset bar
 * that marks "you are here" on this screen. One per page, which is why it
 * lives in the shell and not at the call sites.
 *
 * Everything under the rule is the page's own business: a `Card` with a form,
 * a spec list, a notice band. The shell owns the column width (`max-w-md` by
 * default, overridable through `className`) and nothing else.
 */
 
import type { ReactNode } from "react";
import { cn } from "../../lib/utils";
import { LogoIcon } from "../ui/logo-icon";
import { Separator } from "../ui/separator";
 
interface AuthShellProps {
	/** The one statement on the screen. Rendered as the page's only h1. */
	title: string;
	/** A single line under the title. */
	lead?: ReactNode;
	children: ReactNode;
	/** Printed under a hairline at the foot: the way out of this page. */
	footer?: ReactNode;
	/** Column width override, e.g. `max-w-lg` for a spec list. */
	className?: string;
}
 
export function AuthShell({
	title,
	lead,
	children,
	footer,
	className,
}: AuthShellProps) {
	return (
		<div className="min-h-screen bg-background-base px-4 py-10 sm:py-16">
			<div className={cn("mx-auto w-full max-w-md", className)}>
				<div className="flex items-center gap-2">
					<LogoIcon size={30} className="text-foreground-default" />
					<span className="font-heading text-lg font-semibold text-foreground-default">
						Interioring
					</span>
				</div>
 
				<h1 className="mt-6 font-heading text-3xl font-bold tracking-tight text-foreground-default sm:text-4xl">
					{title}
				</h1>
				{lead ? (
					<p className="mt-2 text-base text-foreground-muted">{lead}</p>
				) : null}
 
				{/* The page rule — the one index-red marker on this screen. */}
				<Separator marked className="mt-5" />
 
				<div className="mt-6">{children}</div>
 
				{footer ? (
					<div className="mt-6 border-t border-border-default pt-4 text-sm text-foreground-muted">
						{footer}
					</div>
				) : null}
			</div>
		</div>
	);
}