refactor(components): component architecture — Shadcn Item as base primitive and layer boundary enforcement#289
refactor(components): component architecture — Shadcn Item as base primitive and layer boundary enforcement#289andrewck24 wants to merge 8 commits intodevfrom
Conversation
- Install Shadcn Item via npx shadcn@latest add item to src/components/ui/item.tsx - Remove custom list-item compound component (superseded by Shadcn Item) - Write Storybook stories for Shadcn Item covering two item forms, action footer pattern, variant/size combinations
…tives - Rewrite PersonItem as thin wrapper over ItemMedia/ItemContent/ItemTitle - Remove href/onClick/action props; consumers use Item asChild for navigation - Add co-located PersonItemSkeleton export with data-testid markers - Install shadcn Skeleton component - Update players/list.tsx to navigable form (Item asChild + Link) - Update roster-list.tsx to static with actions form (Item + ItemActions) - Rewrite tests: data-testid for structure queries, Link instead of <a>
- Rewrite TeamItem as thin wrapper over ItemMedia/ItemContent/ItemTitle - Remove href/onClick/action/className props; consumers use Item asChild - Add co-located TeamItemSkeleton export with data-testid markers - Update invitations to action footer pattern (Item asChild + accept/reject footer) - Update menu to navigable form (Item asChild + button with className) - Rewrite tests: data-testid for structure queries, Link/button via asChild
- Move LoadingCourt from custom/loading/court.tsx to custom/court/index.tsx - Export as named export alongside other court primitives - Update team/lineup and record/index imports accordingly - Delete custom/loading/court.tsx
- Delete unused ui/sheet.tsx (zero consumers) - Relocate ui/panel.tsx to custom/panel/index.tsx, update 9 import paths - Relocate ui/flip-words.tsx to landing/flip-words.tsx, update hero.tsx import - Fix hero.test.tsx mock path for flip-words relocation
- Create docs/architecture.md with layer boundary table (ui/custom/domain) - Document testing conventions: data-testid usage, Link vs <a>, no container.querySelector - Note iterative expansion policy for future changes
Move person-item and team-item to custom/list-item/ subdirectory, mirror test structure under custom/__tests__/list-item/, and update all consumer import paths. Also use Array.from loop for LoadingCourt placeholder cards for consistency with RecordCourt pattern, and update architecture docs to reflect subdirectory grouping convention.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Claude finished @andrewck24's task in 3m 12s —— View job PR Review: component architecture refactor
Overall this is a well-structured refactor. The compound component pattern for Issues1. Invalid Tailwind arbitrary-variant syntax —
|
Summary
Implements the
component-architecturechange. Establishes Shadcn Item as the base presentation primitive, refactorsPersonItem/TeamItemto compose it, enforces component layer boundaries, relocates misplaced components, and documents architecture conventions.Changes
src/components/ui/item.tsxwith full compound component set (Item,ItemMedia,ItemContent,ItemTitle,ItemActions,ItemFooter,ItemGroup,ItemSeparator)ItemMedia/ItemContent/ItemTitle;PersonItemSkeletonco-located; moved tocustom/list-item/TeamItemSkeletonco-located; moved tocustom/list-item/Item asChild+Link) and static with actions (Item+ItemActions)custom/loading/court.tsxtocustom/court/index.tsxas named exportui/panel.tsx→custom/panel/,ui/flip-words.tsx→landing/flip-words.tsx,ui/sheet.tsxdeleted (zero consumers)docs/architecture.mdwith layer boundary table, subdirectory grouping convention, and testing conventions (data-testidusage)摘要
實作
component-architecturechange。以 Shadcn Item 作為基礎展示 primitive,重構PersonItem/TeamItem使用 composition 模式,強制執行 component 層邊界,搬移位置不正確的元件,並記錄架構規範。ui/item.tsx)作為零 domain knowledge 的展示層 primitivePersonItem/TeamItem改為 compose Shadcn Item primitives,skeleton 共同定位,整體移至custom/list-item/asChild+Link)與 static with actionsLoadingCourt、panel、flip-words,刪除零消費者的sheet.tsxdocs/architecture.md記錄 layer 邊界、子目錄分組規範及測試規範