Skip to content

Foundation: Tailwind theme tokens, fonts, breakpoints, and the temporary 'important' flag #2258

Open

Description

@trillium

Trillium Firstmate 🤖

Overview

Move today's colors, fonts, type sizes, and breakpoints out of the MUI theme and into a Tailwind @theme block, and turn on the temporary important flag so Tailwind classes win over MUI and the old global SCSS while both exist. No visible change.

Dependencies

Action Items

  • In client/src/tailwind.css change the import to @import 'tailwindcss' important; and add a comment above it saying this is temporary and which ticket removes it.
  • Add a @theme { ... } block in the same file with semantic tokens whose values are exactly today's values from client/src/theme/palette.js and client/src/theme/index.js:
    • colors: --color-primary (#00008B), --color-secondary (#FA114F), --color-success (#008000), --color-error (#FF0000), --color-background (#FFFFFF), --color-surface (#F1F1F1, the MUI "paper" color), --color-foreground (#000000), --color-foreground-muted (#757575), --color-border-muted (#AAAAAA), --color-foreground-strong (#333333). Rename if a better name fits, but keep the values.
    • fonts: --font-sans (Source Sans Pro, Roboto, "Helvetica Neue", Arial, sans-serif), --font-mono (Source Code Pro), --font-display (the aliseoregular font that index.scss already loads).
    • breakpoints: MUI's are sm 600 px, md 900 px, lg 1200 px; Tailwind's defaults are different (640/768/1024). Set --breakpoint-sm: 600px, --breakpoint-md: 900px, --breakpoint-lg: 1200px so responsive code converts one-to-one.
    • type scale used by the MUI theme today: button 18 px/600, input text 14 px/500, label 16 px/600, h1 30 px bold mono, h3 16 px/600. Add them as --text-* tokens.
  • Delete client/tailwind.config.js (a Tailwind v3 file that v4 ignores) and confirm nothing references it.
  • Keep postcss.config.js (autoprefixer still runs for the SCSS), but note in the PR that Tailwind itself runs through @tailwindcss/vite.
  • Add a Vitest test (client/src/styles/tailwind-theme.test.ts) that reads tailwind.css and checks the token names above exist, so a later rename is noticed.
  • Prove the flag works: temporarily put className="bg-red-600" on an MUI Button and on a plain <button>, confirm both turn red, then remove the test classes. Record the result in the PR.
  • Do not touch theme/palette.js or theme/index.js yet. MUI still reads them until the final MUI removal ticket.

Acceptance Criteria

  • The important flag is on, with a comment pointing to the cleanup ticket.
  • All tokens above exist with the exact same values as the MUI theme.
  • tailwind.config.js is gone and the build output is otherwise unchanged (CSS size change reported in the PR).
  • A before/after screenshot of the home page and the check-in form shows no visible change.
  • yarn typecheck, yarn build and yarn test pass.

Resources/Instructions

Additional Notes

  • The temporary Tailwind important flag is on while MUI is still in the app (decided). That is what lets a Tailwind class beat MUI/emotion and the old global SCSS. It is removed in Final cleanup: remove the Tailwind 'important' flag and the old global SCSS #2288.
  • Decision needed: dark mode. The app is light-only today. Proposed default: out of scope for this epic. Name tokens by purpose (surface, foreground) so a dark palette can be added later by redefining the same names in a .dark block, without changing any component.
  • Decision needed: token naming. The list above is a proposal. The values are the rule.
  • responsiveFontSizes(theme) in theme/index.js makes MUI heading sizes scale with screen width. The typography ticket (UI kit: Heading, Text, and Link #2269) is where that behavior is matched.

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