-
Notifications
You must be signed in to change notification settings - Fork 290
refactor(cards): improve atomic design and reduce duplication #5378
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Unify ActionButtons into single component with `variant` prop (grid/list) - Extract `usePollVote` hook for shared poll voting logic - Extract `useCardActions` hook for card action button handlers - Consolidate RaisedLabel into one component with `focus` prop - Add `isVideoType` prop to FeedbackGrid for API consistency - Delete duplicate ActionButtons implementations and barrel files - Add FeedCardsOverview storybook for visual testing all card variants Co-Authored-By: Claude Opus 4.5 <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
@claude review this please, ensure this can't break any existing implementations |
|
Claude finished @rebelchris's task in 2m 18s —— View job Code Review Complete ✅I've thoroughly reviewed this refactor and it looks excellent. This is a well-executed consolidation that maintains full backward compatibility while significantly reducing code duplication. SummaryOverall Assessment: ✅ APPROVED - No breaking changes detected This refactor successfully:
Detailed Review✅ ActionButtons Consolidation (packages/shared/src/components/cards/common/ActionButtons.tsx)What changed:
Analysis:
Key differences properly handled: grid: {
buttonSize: ButtonSize.Small,
iconSize: IconSize.XSmall,
showTagsPanel: false,
useCommentLink: false, // Button only
}
list: {
buttonSize: undefined,
iconSize: IconSize.Medium,
showTagsPanel: true,
useCommentLink: true, // Link with navigation
}✅ useCardActions Hook (packages/shared/src/hooks/cards/useCardActions.ts)What changed:
Analysis:
Critical behavior preserved: // List variant: close tags panel when switching from downvote to upvote
if (closeTagsPanelOnUpvote && isDownvoteActive && showTagsPanel) {
onClose(true);
}✅ usePollVote Hook (packages/shared/src/hooks/post/usePollVote.ts)What changed:
Analysis:
✅ RaisedLabel Consolidation (packages/shared/src/components/cards/common/RaisedLabel.tsx)What changed:
Analysis:
Minor improvement spotted: // Old: bg-theme-bg-cabbage (non-standard token)
// New: bg-raw-cabbage-40 (correct design system token)✅ Import Path ChangesWhat changed:
Verified imports across all card types:
All imports updated correctly, following CLAUDE.md guidelines to avoid barrel files. Potential Issues
|
Summary
variantprop, reducing ~150 lines of duplicate codeusePollVoteanduseCardActionshooks for shared logic across card componentsfocuspropChanges
variantpropusePollVotehookuseCardActionshookfocuspropTest plan
🤖 Generated with Claude Code
Preview domain
https://refactor-feed-cards-atomic-desig.preview.app.daily.dev