feat(frontend): add cabinet shells, brand tokens, and state primitives
This commit is contained in:
1 parent
dda3825786
commit
0e2a3b02ab
85 files changed
+3313
-113
No files matched your search
@@ -0,0 +1,117 @@
|
||||
.page {
|
||||
width: 100%;
|
||||
margin-inline: auto;
|
||||
padding: var(--space-6) var(--gutter) var(--space-8);
|
||||
}
|
||||
|
||||
.narrow {
|
||||
max-width: calc(var(--content-width-narrow) + 2 * var(--gutter));
|
||||
}
|
||||
|
||||
.wide {
|
||||
max-width: calc(var(--content-width-wide) + 2 * var(--gutter));
|
||||
}
|
||||
|
||||
.page-header {
|
||||
display: grid;
|
||||
gap: var(--space-3);
|
||||
padding-bottom: var(--space-5);
|
||||
border-bottom: var(--line-thin) solid var(--color-divider);
|
||||
}
|
||||
|
||||
.eyebrow {
|
||||
color: var(--color-accent);
|
||||
font-size: var(--font-size-xs);
|
||||
font-weight: var(--font-weight-bold);
|
||||
letter-spacing: var(--letter-spacing-label);
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: var(--font-size-display);
|
||||
font-weight: var(--font-weight-bold);
|
||||
letter-spacing: var(--letter-spacing-display);
|
||||
line-height: var(--line-height-tight);
|
||||
overflow-wrap: anywhere;
|
||||
hyphens: auto;
|
||||
}
|
||||
|
||||
.lead {
|
||||
max-width: 38rem;
|
||||
color: var(--color-text-secondary);
|
||||
font-size: var(--font-size-l);
|
||||
line-height: var(--line-height-body);
|
||||
}
|
||||
|
||||
.page-body {
|
||||
display: grid;
|
||||
gap: var(--space-6);
|
||||
padding-top: var(--space-6);
|
||||
}
|
||||
|
||||
.section {
|
||||
position: relative;
|
||||
display: grid;
|
||||
gap: var(--space-3);
|
||||
padding-left: var(--space-5);
|
||||
}
|
||||
|
||||
/* Node at the heading plus a thin line down the section. */
|
||||
.connector {
|
||||
position: absolute;
|
||||
top: 0.55em;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width: var(--space-3);
|
||||
border-left: var(--line-thin) solid var(--color-accent);
|
||||
border-bottom-left-radius: var(--radius-m);
|
||||
}
|
||||
|
||||
.connector::before {
|
||||
position: absolute;
|
||||
top: -0.3rem;
|
||||
left: calc(-0.3rem - 0.5px);
|
||||
width: 0.6rem;
|
||||
height: 0.6rem;
|
||||
border-radius: 50%;
|
||||
content: "";
|
||||
background: var(--color-accent);
|
||||
}
|
||||
|
||||
.section-title {
|
||||
font-size: var(--font-size-xl);
|
||||
font-weight: var(--font-weight-bold);
|
||||
}
|
||||
|
||||
.section-description {
|
||||
color: var(--color-text-secondary);
|
||||
}
|
||||
|
||||
.section-body {
|
||||
display: grid;
|
||||
gap: var(--space-4);
|
||||
padding-top: var(--space-2);
|
||||
}
|
||||
|
||||
.stack {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--stack-gap);
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.stack[data-direction="row"] {
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
.stack[data-wrap] {
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.stack[data-align="start"] {
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.stack[data-align="center"] {
|
||||
align-items: center;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
import type { ReactNode } from "react";
|
||||
import styles from "./layout.module.css";
|
||||
|
||||
const productName = "Lincodex";
|
||||
|
||||
type PageProps = {
|
||||
/** Text of the page's single h1 and of the document title. */
|
||||
title: string;
|
||||
/** Short context line above the heading, for example the cabinet name. */
|
||||
eyebrow?: string | undefined;
|
||||
lead?: ReactNode;
|
||||
width?: "narrow" | "wide";
|
||||
children?: ReactNode;
|
||||
};
|
||||
|
||||
/**
|
||||
* Page content inside a shell's main landmark. It owns the only h1 of the
|
||||
* page and sets the document title (React hoists <title> into <head>).
|
||||
*/
|
||||
export function Page({ title, eyebrow, lead, width = "narrow", children }: PageProps) {
|
||||
return (
|
||||
<div className={`${styles.page} ${styles[width]}`}>
|
||||
<title>{`${title} - ${productName}`}</title>
|
||||
<header className={styles["page-header"]}>
|
||||
{eyebrow ? <p className={styles.eyebrow}>{eyebrow}</p> : null}
|
||||
<h1 className={styles.title}>{title}</h1>
|
||||
{lead ? <div className={styles.lead}>{lead}</div> : null}
|
||||
</header>
|
||||
{children ? <div className={styles["page-body"]}>{children}</div> : null}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
import { useId, type ReactNode } from "react";
|
||||
import styles from "./layout.module.css";
|
||||
|
||||
type SectionProps = {
|
||||
title: string;
|
||||
headingLevel?: 2 | 3;
|
||||
description?: ReactNode;
|
||||
children?: ReactNode;
|
||||
};
|
||||
|
||||
/**
|
||||
* Titled block of a page. A thin connector line with a node marks the
|
||||
* section, echoing the brand's linked-facts graphics; it is decorative.
|
||||
*/
|
||||
export function Section({ title, headingLevel = 2, description, children }: SectionProps) {
|
||||
const headingId = useId();
|
||||
const Heading = headingLevel === 2 ? "h2" : "h3";
|
||||
|
||||
return (
|
||||
<section className={styles.section} aria-labelledby={headingId}>
|
||||
<span className={styles.connector} aria-hidden="true" />
|
||||
<Heading id={headingId} className={styles["section-title"]}>
|
||||
{title}
|
||||
</Heading>
|
||||
{description ? <div className={styles["section-description"]}>{description}</div> : null}
|
||||
{children ? <div className={styles["section-body"]}>{children}</div> : null}
|
||||
</section>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
import type { CSSProperties, ReactNode } from "react";
|
||||
import styles from "./layout.module.css";
|
||||
|
||||
type SpaceStep = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
|
||||
|
||||
type StackProps = {
|
||||
gap?: SpaceStep;
|
||||
direction?: "column" | "row";
|
||||
/** Rows wrap onto new lines on narrow screens. */
|
||||
wrap?: boolean;
|
||||
align?: "start" | "center" | "stretch";
|
||||
children: ReactNode;
|
||||
};
|
||||
|
||||
/** Flex container with a gap from the spacing scale. */
|
||||
export function Stack({
|
||||
gap = 4,
|
||||
direction = "column",
|
||||
wrap = false,
|
||||
align = "stretch",
|
||||
children,
|
||||
}: StackProps) {
|
||||
const style = { "--stack-gap": `var(--space-${gap})` } as CSSProperties;
|
||||
return (
|
||||
<div
|
||||
className={styles.stack}
|
||||
style={style}
|
||||
data-direction={direction}
|
||||
data-wrap={wrap || undefined}
|
||||
data-align={align}
|
||||
>
|
||||
{children}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user