Skip to content

UI kit: Spinner, Stack, Container, and Card #2270

Open

Description

@trillium

Trillium Firstmate 🤖

Overview

Create the small shared pieces that replace MUI CircularProgress (8 files), Box/Grid/Container layout wrappers, and Paper.

Dependencies

Action Items

  • client/src/components/ui/spinner.tsx: a CSS-only spinning ring in the primary color, sizes sm/md/lg (MUI default is 40 px), role="status" and an accessible label (default "Loading"), and respects prefers-reduced-motion.
  • client/src/components/ui/stack.tsx: flex layout with direction, gap, align, justify, wrap props (maps to Tailwind classes). This covers most Box and Grid container uses.
  • client/src/components/ui/container.tsx: centered max-width wrapper (replaces MUI Container in 4 files; MUI default has 16/24 px side padding and the maxWidth="lg" default).
  • client/src/components/ui/card.tsx: the surface used for Paper in ProjectForm.jsx (grey #F1F1F1 background, same radius and shadow as MUI Paper).
  • Add the optional loading prop to Button from UI kit: Button component #2262 now that the spinner exists (small follow-up in this PR).
  • Tests for each (spinner has status role and label; stack applies the right classes; container constrains width; card renders children).
  • Catalogue entries and a Patterns section example "page header with actions" built from Stack.

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

  • MUI uses to replace: CircularProgress in Home.jsx, UserWelcome.jsx, ProjectList.jsx, ProjectForm.jsx, OnboardOffboardVisibility.jsx, HandleAuth.jsx, donutChartLoading.jsx, editPMs/buttonGroup.jsx; Container in NewUser.jsx, Users.jsx, EditUsers.jsx, donutChartLoading.jsx; Paper in ProjectForm.jsx.
  • Layout rule (documented in the Patterns section): use Stack for rows/columns; use grid grid-cols-* classes directly for true grids. There is no Grid component, because the MUI Grid (37 uses) maps to Tailwind grid/flex classes.

Additional Notes

  • Decision needed: Box. MUI Box (36 files) is a plain div with styles. Proposed default: no Box component; use div with Tailwind classes, or Stack. Only add a Box primitive if reviewers want one name for "generic container".

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