Skip to content

UI kit: Heading, Text, and Link #2269

Open

Description

@trillium

Trillium Firstmate 🤖

Overview

Create the shared text components that replace MUI Typography (used in 29 files) and Link, and the raw <h1>-<h6>, <p>, and <a> elements, so text sizes come from one scale.

Dependencies

Action Items

  • Create client/src/components/ui/heading.tsx: <Heading level={1-6} size?> where the tag (level) and the visual size are separate props, so the right tag can be used for structure.
  • Create client/src/components/ui/text.tsx: <Text> for body copy with variants matching the MUI ones in use: body1, body2, caption, muted (grey), error, and a mono option.
  • Create client/src/components/ui/link.tsx: styled link that works with React Router v5 (NavLink / Link via asChild or an href/to prop) and plain external links (target/rel set correctly).
  • Map the Typography variants used today: h1 x8, h3 x8, h4 x8, h6 x6, body1 x5, body2 x2, h2 x1. The MUI theme sets h1 to 30 px bold Source Code Pro with a 1.5rem bottom margin, h3 to 16 px/600 Source Sans Pro. MUI's responsiveFontSizes shrinks heading sizes on narrow screens; measure the real rendered sizes at 390 px and 1280 px in the running app and match them with responsive classes.
  • Tests: heading renders the requested tag with the requested size class; Text variants; Link renders an anchor with the right href and external-link attributes.
  • Add the type scale specimens to the Foundations section and entries for the three components in the catalogue.

Acceptance Criteria

  • The component lives in client/src/components/ui/ as a .tsx file, with typed props that pass yarn typecheck (strict mode).
  • Styling uses Tailwind classes only. Variants (if any) are declared with cva, and className is merged with cn() so callers can override.
  • The component does not import anything from @mui/* or @emotion/*.
  • A test file next to the component (for example button.test.tsx) covers: it renders, each variant/size, the disabled and error states where they apply, and keyboard use where it applies (Tab, Enter/Space, Escape, arrow keys). yarn test passes.
  • The component has an entry on the /design-system page: description, props/variants, states, a short do/don't, a code example, and a live demo.
  • Visible focus: there is a clear focus ring when the control is reached by keyboard.
  • The PR does not change any existing screen. Screens adopt the component in their own tickets.

Resources/Instructions

Additional Notes

  • The app's raw <h*> tags rely on the global index.scss sizes and the aliseoregular display font. Do not migrate those screens here; the screen tickets decide per heading whether it keeps the display font.

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions