feat(web): the console joins the shared design system
Server Deploy / deploy (push) Successful in 1m6s
Server Deploy / deploy (push) Successful in 1m6s
web/ was the last app on its own palette — a neutral #0f1117 ground with an indigo accent, unrelated to the logo navy that site/ and adminsite/ are built on. It now draws from the same tokens, so all three apps are one system. It stays locked to dark, taking site/'s dark values. That is what keeps adminsite/'s light default meaningful: an operator with both open tells them apart by the ground before clicking anything destructive, and now that both are the same palette, the ground is the only thing left doing that work. The colour names stay this app's own — text-primary, border, surface rather than ink, rule, panel — because every screen already reads that way, and adminsite/ already establishes that each app names the shared tokens after its own subject. Tokens are stored as RGB channels with the hex in a trailing comment. The console leans on Tailwind opacity modifiers far more than the other two (bg-danger/10, border-accent/50, ring-accent/30), and <alpha-value> only compiles against channels; the comments keep the three token blocks diffable by eye. Beyond colour: - radii collapse to site/'s 4px in tailwind.config.ts rather than rewriting ~140 rounded-lg classes; rounded-full is untouched for dots and pills - badges become site/'s chip — mono, uppercase, tracked, currentColor rule, no fill — keeping their dot so state is never colour alone - table column heads take the keyed-label idiom, at text-secondary rather than tertiary, which lands under 4.5:1 at that size - sidebar marks the active item with an accent bar, the device site/ uses for the chosen plan, instead of a filled pill that reads as pressable - filled accent and danger buttons take accent-ink; the dark accent is a light blue and danger a coral, and white on either was unreadable - login's packet pulses shift from green to the accent, so the sign-in screen is the same two blues as the marketing hero The last hex literals and stock-palette classes are gone; the only ones left are NetworkBackground's canvas fills, which cannot read a CSS variable and are commented with the token each came from. Only the web image rebuilds from this.
This commit is contained in:
+18
-15
@@ -8,32 +8,35 @@ interface BadgeProps {
|
||||
className?: string;
|
||||
}
|
||||
|
||||
/*
|
||||
* site/'s .chip: mono, uppercase, widely tracked, drawn in currentColor with
|
||||
* no fill. Every badge in this app holds one short state word, which is what
|
||||
* the treatment is for.
|
||||
*
|
||||
* State is never carried by colour alone — the word itself says it, and the
|
||||
* three state variants add a dot so the distinction survives a monochrome
|
||||
* screen as well as it survives colour blindness.
|
||||
*/
|
||||
const variantClasses: Record<Variant, string> = {
|
||||
success: "bg-success/15 text-success border-success/30",
|
||||
warning: "bg-warning/15 text-warning border-warning/30",
|
||||
danger: "bg-danger/15 text-danger border-danger/30",
|
||||
neutral: "bg-surface-2 text-text-secondary border-border",
|
||||
accent: "bg-accent/15 text-accent border-accent/30",
|
||||
success: "text-success",
|
||||
warning: "text-warning",
|
||||
danger: "text-danger",
|
||||
neutral: "text-text-secondary",
|
||||
accent: "text-accent",
|
||||
};
|
||||
|
||||
export function Badge({ variant = "neutral", children, className }: BadgeProps) {
|
||||
const hasState = variant === "success" || variant === "warning" || variant === "danger";
|
||||
|
||||
return (
|
||||
<span
|
||||
className={clsx(
|
||||
"inline-flex items-center gap-1 rounded-full border px-2.5 py-0.5 text-xs font-medium",
|
||||
"inline-flex items-center gap-1.5 whitespace-nowrap rounded-sm border border-current px-1.5 py-0.5 font-mono text-[0.65rem] uppercase tracking-[0.08em]",
|
||||
variantClasses[variant],
|
||||
className
|
||||
)}
|
||||
>
|
||||
{(variant === "success" || variant === "warning" || variant === "danger") && (
|
||||
<span
|
||||
className={clsx("h-1.5 w-1.5 rounded-full", {
|
||||
"bg-success": variant === "success",
|
||||
"bg-warning": variant === "warning",
|
||||
"bg-danger": variant === "danger",
|
||||
})}
|
||||
/>
|
||||
)}
|
||||
{hasState && <span className="h-1.5 w-1.5 rounded-full bg-current" />}
|
||||
{children}
|
||||
</span>
|
||||
);
|
||||
|
||||
@@ -10,13 +10,18 @@ interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
||||
loading?: boolean;
|
||||
}
|
||||
|
||||
/*
|
||||
* site/'s .btn--solid and .btn--line, in Tailwind. Both filled variants take
|
||||
* accent-ink rather than white: on the dark ground the accent lifts to a light
|
||||
* blue and danger to a coral, and white on either is unreadable.
|
||||
*/
|
||||
const variantClasses: Record<Variant, string> = {
|
||||
primary:
|
||||
"bg-accent hover:bg-accent-hover text-white border-transparent",
|
||||
"bg-accent hover:bg-accent-hover text-accent-ink border-accent hover:border-accent-hover",
|
||||
secondary:
|
||||
"bg-surface-2 hover:bg-[#2d3048] text-text-primary border-border",
|
||||
"bg-surface hover:border-text-tertiary text-text-primary border-border",
|
||||
danger:
|
||||
"bg-danger hover:bg-danger-hover text-white border-transparent",
|
||||
"bg-danger hover:bg-danger-hover text-accent-ink border-danger hover:border-danger-hover",
|
||||
ghost:
|
||||
"bg-transparent hover:bg-surface-2 text-text-secondary hover:text-text-primary border-transparent",
|
||||
};
|
||||
@@ -37,7 +42,7 @@ export const Button = forwardRef<HTMLButtonElement, ButtonProps>(
|
||||
ref={ref}
|
||||
disabled={disabled || loading}
|
||||
className={clsx(
|
||||
"inline-flex items-center gap-2 rounded-lg border font-medium transition-colors duration-150 focus:outline-none focus:ring-2 focus:ring-accent focus:ring-offset-2 focus:ring-offset-background disabled:opacity-50 disabled:cursor-not-allowed",
|
||||
"inline-flex items-center gap-2 rounded border font-semibold transition-colors duration-150 focus:outline-none focus:ring-2 focus:ring-accent focus:ring-offset-2 focus:ring-offset-background disabled:opacity-50 disabled:cursor-not-allowed active:translate-y-px",
|
||||
variantClasses[variant],
|
||||
sizeClasses[size],
|
||||
className
|
||||
|
||||
@@ -9,7 +9,9 @@ export function Card({ className, padding = true, children, ...props }: CardProp
|
||||
return (
|
||||
<div
|
||||
className={clsx(
|
||||
"rounded-xl border border-border bg-surface",
|
||||
// Borders, not shadows. site/ builds its panels out of rules and the
|
||||
// console has far more panels per screen than the site does.
|
||||
"rounded border border-border bg-surface",
|
||||
padding && "p-6",
|
||||
className
|
||||
)}
|
||||
@@ -30,7 +32,7 @@ export function CardHeader({ className, children, ...props }: HTMLAttributes<HTM
|
||||
|
||||
export function CardTitle({ className, children, ...props }: HTMLAttributes<HTMLHeadingElement>) {
|
||||
return (
|
||||
<h2 className={clsx("text-lg font-semibold text-text-primary", className)} {...props}>
|
||||
<h2 className={clsx("text-lg font-extrabold tracking-[-0.03em] text-text-primary", className)} {...props}>
|
||||
{children}
|
||||
</h2>
|
||||
);
|
||||
|
||||
@@ -28,7 +28,7 @@ export function Modal({
|
||||
<div className="fixed inset-0 z-50 flex items-center justify-center p-4">
|
||||
<div className="absolute inset-0 bg-black/60" onClick={onClose} />
|
||||
<div
|
||||
className={`relative z-10 w-full ${wide ? "max-w-2xl" : "max-w-md"} max-h-[90vh] overflow-auto rounded-xl border border-border bg-surface shadow-2xl`}
|
||||
className={`relative z-10 w-full ${wide ? "max-w-2xl" : "max-w-md"} max-h-[90vh] overflow-auto rounded border border-border bg-surface shadow-panel`}
|
||||
role="dialog"
|
||||
aria-modal="true"
|
||||
>
|
||||
|
||||
@@ -45,7 +45,11 @@ export function Th({ className, children, ...props }: ThHTMLAttributes<HTMLTable
|
||||
return (
|
||||
<th
|
||||
className={clsx(
|
||||
"px-4 py-3 text-left text-xs font-semibold uppercase tracking-wider text-text-secondary",
|
||||
// site/'s keyed-label idiom: mono, small, widely tracked, dimmed.
|
||||
// A column head is a key, not prose.
|
||||
// text-secondary, not tertiary: a column head is how you navigate the
|
||||
// table, and tertiary lands under 4.5:1 at this size.
|
||||
"px-4 py-3 text-left font-mono text-[0.68rem] uppercase tracking-[0.13em] text-text-secondary",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
|
||||
Reference in New Issue
Block a user