Repository navigation
Open
Labels
feature: Design systemRelated to design patterns and componentsmilestone: missingp-feature: Buttonsrole: Front Endsize: 2ptCan be done in 7-12 hours
Description
Trillium Firstmate 🤖
Overview
Create the shared Button that replaces the MUI Button (used in 20 files) and the raw <button> elements, with the same look as today.
Dependencies
- Foundation: Tailwind theme tokens, fonts, breakpoints, and the temporary 'important' flag #2258
- Add a /design-system page that catalogues tokens and components #2260
Action Items
- Create
client/src/components/ui/button.tsxwithcvavariants that match today's buttons. Read how buttons look now:client/src/theme/index.js(MuiButton: Source Sans Pro, 18 px, weight 600, no uppercase) and thevariant="secondary"style (3 px primary-color border), plus thecontained,outlined, andtextMUI variants used in the app (14 outlined, 9 contained, 1 text).- Variants:
primary(contained),outline,secondary(3 px primary border),text,destructive(for delete actions currently using the error color). - Sizes:
default,sm,icon(for the icon-only close/delete buttons). - Props: all native
<button>props,asChild(use RadixSlot, so a button can render a React RouterNavLink, whichNavbar.jsxneeds), and aloadingstate that shows the spinner once the spinner ticket exists (add it then; for nowdisabled).
- Variants:
- Remember the old global rule
button { width: 100%; height: 100% }inclient/src/index.scss. The new Button must not inherit it (theimportantflag handles this; add a test or note proving it). - Add the Radix Slot package (
@radix-ui/react-slot). - Add colocated
button.test.tsx: renders text, each variant has its class, click fires, disabled does not fire, Enter/Space activate it,asChildrenders a link element. - Add a catalogue entry (all variants and sizes, disabled, focus ring).
Acceptance Criteria
- The component lives in
client/src/components/ui/as a.tsxfile, with typed props that passyarn typecheck(strict mode). - Styling uses Tailwind classes only. Variants (if any) are declared with
cva, andclassNameis merged withcn()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 testpasses. - The component has an entry on the
/design-systempage: 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.
- A screenshot in the PR puts the new Button next to an MUI
Buttonfor each variant at the same size, showing they match.
Resources/Instructions
- Today's definitions:
client/src/theme/index.js,client/src/index.scss. - Examples of current uses:
components/presentational/CheckInButtons.jsx,components/Footer.jsx,pages/Users.jsx. - Radix Slot: https://www.radix-ui.com/primitives/docs/utilities/slot
- shadcn-style button for reference on the cva pattern: https://ui.shadcn.com/docs/components/button
Additional Notes
- If a visual variant is used only once, do not add a variant; the screen ticket can pass classes through
className. - The
loadingprop is optional here to keep the PR small.
Metadata
Metadata
Assignees
Labels
feature: Design systemRelated to design patterns and componentsmilestone: missingp-feature: Buttonsrole: Front Endsize: 2ptCan be done in 7-12 hours
Type
Projects
- StatusShow more project fieldsNew Issue Approval
Activity