Open History to see the last commit
1import type { ReactNode } from "react";
2
3const backdropClassNames = {
4 pairing:
5 "absolute inset-x-0 top-0 h-44 bg-[radial-gradient(44rem_16rem_at_top,color-mix(in_srgb,var(--color-emerald-500)_14%,transparent),transparent)]",
6 error:
7 "absolute inset-x-0 top-0 h-44 bg-[radial-gradient(44rem_16rem_at_top,color-mix(in_srgb,var(--color-red-500)_16%,transparent),transparent)]",
8 brand:
9 "absolute inset-x-0 top-0 h-72 bg-[radial-gradient(48rem_20rem_at_top,color-mix(in_srgb,var(--color-blue-500)_12%,transparent),transparent)]",
10};
11
12export function StandalonePage({
13 tone,
14 masthead,
15 children,
16}: {
17 readonly tone: keyof typeof backdropClassNames;
18 readonly masthead?: ReactNode;
19 readonly children: ReactNode;
20}) {
21 return (
22 // #root never scrolls, so the page owns its scroll. Safe centering keeps a
23 // card taller than the viewport anchored at the top instead of clipping it.
24 <div className="relative h-full overflow-hidden bg-background text-foreground">
25 <div className="pointer-events-none absolute inset-0 opacity-80" aria-hidden>
26 <div className={backdropClassNames[tone]} />
27 {tone === "pairing" ? (
28 <div className="absolute inset-y-0 left-0 w-72 bg-[radial-gradient(28rem_18rem_at_left,color-mix(in_srgb,var(--color-sky-500)_10%,transparent),transparent)]" />
29 ) : null}
30 <div
31 className={
32 tone === "brand"
33 ? "absolute inset-0 bg-[linear-gradient(145deg,color-mix(in_srgb,var(--background)_94%,var(--color-black))_0%,var(--background)_62%)]"
34 : "absolute inset-0 bg-[linear-gradient(145deg,color-mix(in_srgb,var(--background)_90%,var(--color-black))_0%,var(--background)_55%)]"
35 }
36 />
37 </div>
38
39 <div className="relative flex h-full items-center-safe justify-center overflow-y-auto scrollbar-gutter-both px-4 py-10 sm:px-6">
40 <section
41 className={`relative w-full max-w-xl rounded-2xl border border-border/80 shadow-2xl shadow-black/20 backdrop-blur-md ${tone === "brand" ? "overflow-hidden bg-card/94" : "bg-card/90"}`}
42 >
43 {masthead}
44 <div className="p-6 sm:p-8">{children}</div>
45 </section>
46 </div>
47 </div>
48 );
49}
50
51export function StandalonePageHeader({
52 eyebrow,
53 title,
54 description,
55}: {
56 readonly eyebrow: ReactNode;
57 readonly title: ReactNode;
58 readonly description: ReactNode;
59}) {
60 return (
61 <>
62 <p className="text-[11px] font-semibold tracking-[0.18em] text-muted-foreground uppercase">
63 {eyebrow}
64 </p>
65 <h1 className="mt-3 text-2xl font-semibold tracking-tight sm:text-3xl">{title}</h1>
66 <p className="mt-2 text-sm leading-relaxed text-muted-foreground">{description}</p>
67 </>
68 );
69}