Skip to content

Add a /design-system page that catalogues tokens and components #2260

Open

Description

@trillium

Trillium Firstmate 🤖

Overview

Add one in-app page, /design-system, where volunteers can see the principles, tokens, and every shared component with a live demo. Each later component ticket adds its own entry, so the page is the single place to look before building UI.

Dependencies

Action Items

  • Create client/src/pages/DesignSystem/index.tsx and add a /design-system route in the routes array of client/src/App.jsx (React Router v5). The page is public and not linked from the navbar.
  • Build the page from eight sections, each a <section> with a stable id so people can link to it: ds-principles, ds-foundations, ds-tokens, ds-components, ds-patterns, ds-content, ds-accessibility, ds-governance.
    • Principles: 4-6 short rules that settle design arguments (for example "match the existing look", "one primitive per job", "keyboard first").
    • Foundations: color swatches, type scale specimens, spacing and breakpoints, radius, shadow, motion, icon set.
    • Tokens: a table of every @theme token from the tokens ticket with name, value, and a swatch. Drive it from a typed list in client/src/pages/DesignSystem/tokens.ts, and add a Vitest check that every token in that list exists in client/src/tailwind.css.
    • Components: render one ComponentDoc per primitive from a registry file client/src/pages/DesignSystem/component-docs.tsx (empty at first, with the ComponentDoc layout component: name, description, props/variants table, states, do/don't, code example, live demo). Later tickets append to this registry.
    • Patterns: placeholder list of the layouts and flows that will be documented (form, list with actions, dialog confirm, page header).
    • Content guidelines: voice and microcopy rules, filled in from how the app words things today (button labels, error messages, empty states).
    • Accessibility: contrast, visible focus, keyboard support, reduced motion.
    • Governance: how to add or change a component (build in components/ui/, add the test, add the catalogue entry, migrate call sites), and who to ask (the VRMS front-end lead).
  • Add a Vitest test that renders the page and checks all eight section ids are present.
  • Add a one-line mention of the page to client/src/components/ui/README.md.

Acceptance Criteria

  • /design-system loads without errors and shows all eight sections.
  • The Tokens table matches tailwind.css, and the Vitest check fails if a listed token is missing there.
  • The ComponentDoc layout and registry exist so the next ticket can add an entry with one small file change.
  • The page uses only Tailwind classes (no @mui/*, no new .scss).
  • Page looks right at 1280 px and at 390 px width.
  • yarn typecheck, yarn build and yarn test pass.

Resources/Instructions

Additional Notes

  • Decision needed: where the page renders. The app shell currently shows every page inside a 500 px-wide white box (App.jsx). Proposed default: render inside the existing shell, single column, so the catalogue shows components at the width they really appear. If that is too cramped, the app-shell ticket can add a wider layout for this route.
  • Decision needed: visibility. Proposed default: public but unlinked. Alternative: show only when import.meta.env.DEV is true.
  • Only the Components section grows over time. The other sections are written once here and edited when a decision changes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature: Design systemmilestone: missingrole: Front Endsize: 3pt

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions