Repository navigation
Open
Labels
feature: Design systemRelated to design patterns and componentsmilestone: missingrole: Front Endsize: 2ptCan be done in 7-12 hours
Description
Trillium Firstmate 🤖
Overview
Set up the small pieces every shared UI component will need, so later tickets can just add components. No screen changes and no visible change in the app.
Dependencies
- Tailwind upgrade to the latest stable release: Update package: tailwindcss #2253
The Tailwind upgrade must land first because it fixes Vite plugin issues around CSS @import and path aliases that this migration relies on.
Action Items
Run yarn commands from client/, and commit client/package.json and client/yarn.lock together.
- Add dependencies:
clsx,tailwind-merge,class-variance-authority, andlucide-react(used by the icons ticket).classnamesstays for now; old code keeps using it. - Create
client/src/lib/cn.tsexportingcn(...inputs)=twMerge(clsx(inputs)), fully typed. Addcn.test.ts(merges conflicting Tailwind classes, drops falsy values). - Add an
@/import alias that points toclient/src: inclient/vite.config.mjs(resolve.alias, next to the existing@sharedalias) and inclient/tsconfig.json(paths). Confirmyarn typecheck,yarn buildandyarn teststill pass. - Create the folder
client/src/components/ui/for shared primitives, with a shortREADME.mdexplaining the rules: one component per file, file names are lowercase-kebab (button.tsx,radio-group.tsx), each file is.tsx, typed props,cvafor variants,cn()forclassName, no@mui/*or@emotion/*imports, no.scssimports, and each component gets a colocated*.test.tsx. - Add Vitest support for component tests:
@testing-library/user-eventand@testing-library/jest-domas dev dependencies, plus a setup file (for exampleclient/src/test/setup.ts, registered astest.setupFilesinvite.config.mjs). In the setup file add the small browser stubs that jsdom lacks and that Radix components need (ResizeObserver,Element.prototype.scrollIntoView,hasPointerCapture/releasePointerCapture,window.matchMedia). - Add one sample test that renders a throwaway element and uses
userEventand ajest-dommatcher, to prove the setup works. Delete the sample once the first real primitive test exists, or keep it astest/setup.test.ts. - Radix packages are not added here; each component ticket installs the ones it needs.
- In the PR description list how to write and run a component test:
yarn testinclient/.
Acceptance Criteria
-
yarn typecheck,yarn buildandyarn testpass inclient/. -
import { cn } from "@/lib/cn"works from both a.tsxand a.jsxfile. -
client/src/components/ui/README.mdexists and lists the rules above. - The app looks and behaves exactly the same (no screen file changed other than imports if any).
- The bundle size change is noted in the PR (
yarn buildoutput before/after).
Resources/Instructions
- Tailwind v4 with Vite: https://tailwindcss.com/docs/installation/using-vite
cnpattern (clsx + tailwind-merge) andcva: https://cva.style/docs- Vitest setup files: https://vitest.dev/config/#setupfiles
- Existing config to edit:
client/vite.config.mjs,client/tsconfig.json. - TypeScript is already set up for the client (
allowJs: true,checkJs: false), so.tsxprimitives can be imported from existing.jsxfiles.
Additional Notes
- Why
@/: today only@sharedhas an alias, and deep relative imports like../../parts/form/...are easy to get wrong. Proposed default:@/=client/src. If the team prefers relative imports, say so on the ticket and this item can be dropped. - Packages are installed with
yarninclient/, matching how the client is installed today. - The icon package (
lucide-react) is installed here only so the icons ticket does not need to touch dependencies; if you prefer to install it there, move this item.
Metadata
Metadata
Assignees
Labels
feature: Design systemRelated to design patterns and componentsmilestone: missingrole: Front Endsize: 2ptCan be done in 7-12 hours
Type
Projects
- StatusShow more project fieldsNew Issue Approval
Activity