Conversation
Migrates Button, PlainButton, ButtonLink, and ButtonGroup components from styled-components to plain CSS modules while maintaining backward compatibility. Changes: - Created Button.css with all button styles and variants - Refactored Button.tsx to use plain CSS classes and CSS variables - Created Button.legacy.ts for backward compatibility with styled-components - Enhanced Button.spec.tsx with additional test coverage Key features preserved: - All button variants (primary, secondary, transparent, default) - All sizes (small, medium, large) - Disabled state - Component polymorphism via component prop - ButtonGroup layout options - ButtonLink decorated/undecorated modes Follows migration patterns from PLAIN_CSS_MIGRATION_LEARNINGS.md: - Uses classnames package for className composition - Normal function declarations (not React.FC) - CSS variables set before ...style spread - CSS variable fallbacks in CSS file - Legacy exports in separate .legacy.ts file 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Add React.forwardRef to Button, PlainButton, and ButtonLink components to support ref forwarding - Remove invalid 'default' prop from Button usage in ShowAnswerButton and SkipAndSubmitButtons - Fixes TypeScript errors where ref was not allowed on Button components This addresses review feedback from PR #2824 where the linter identified that ref was not an allowed prop. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
fb1c063 to
d110c18
Compare
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
02d3487 to
8591bce
Compare
This comment was marked as resolved.
This comment was marked as resolved.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
38340c9 to
c3e77cc
Compare
This comment was marked as resolved.
This comment was marked as resolved.
Summary of All Review Feedback - Phase 2.1 Button MigrationAll review comments (Reviews 1-11) have been addressed. Here's a complete summary: ✅ Reviews 1-3: TypeScript Ref ErrorsFixed: Added ✅ Reviews 4-9: PrettyFormatPluginError in SnapshotsFixed: Applied multiple fixes following the established Phase 1 patterns:
✅ Review 10: decoratedLinkStyle CoverageVerified: The
|
Removed the unused disabled prop conditional from decoratedLinkStyle in Typography.legacy.ts. This conditional was never used in production code - all 3 usages (PrevNextBar.tsx, Attribution.tsx, and Topbar/styled.tsx) do not pass a disabled prop. This change: - Improves code coverage by removing untested dead code - Simplifies the decoratedLinkStyle implementation - Has no impact on existing functionality since the branch was never executed Addresses review feedback from PR #2824 Review 12. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This comment was marked as resolved.
This comment was marked as resolved.
…riable ordering 1. Add disabled state CSS styling for ButtonLink: - Added cursor: not-allowed, opacity: 0.6, pointer-events: none - Disabled decorated underline animation (width: 0, transparent background) - Supports both [disabled] and [aria-disabled='true'] attributes - Required because AllOrNone.tsx uses ButtonLink with disabled prop 2. Fix CSS variable ordering in ButtonLink style prop: - Changed order from CSS vars first, then ...style - To: ...style first, then CSS vars - This ensures CSS variables take precedence over user-provided styles - Prevents custom styles from accidentally overriding theme colors Addresses Review 13-14 feedback and Copilot inline comments. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This comment was marked as resolved.
This comment was marked as resolved.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 51 out of 51 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
Migrates the button component system from styled-components to plain CSS modules, following the established patterns from Phases 1.1-1.5. This migration maintains backward compatibility through legacy exports while providing new CSS-based implementations.
Resolves: CORE-1695
Components Migrated
All components in
src/app/components/Button.tsx:Button - Main button component with:
primary,secondary,transparent,defaultlarge,medium(default),smallPlainButton - Unstyled button base (no margin, padding, border, background)
ButtonLink - Button styled as a link (uses PlainButton + link styles)
ButtonGroup - Container for button groups with grid layout
Changes
Created Files
src/app/components/Button.css- Plain CSS styles for all button componentssrc/app/components/Button.legacy.ts- Legacy styled-components exports for backward compatibilityModified Files
src/app/components/Button.tsx- Refactored to use plain CSS classes and CSS variablessrc/app/components/Button.spec.tsx- Enhanced with additional test coverageMigration Approach
Hybrid Strategy
Following Phase 1.1-1.5 patterns:
Button.legacy.tsfor backward compatibilityComponent Polymorphism
The current Button component supports a
componentprop for polymorphic rendering. This is preserved usingReact.cloneElementto maintain compatibility.Theme Integration
CSS variables are bound for theme colors:
theme.color.primary.orangetheme.color.secondary.lightGraytheme.color.neutraltheme.color.disabledMigration Checklist
Following
PLAIN_CSS_MIGRATION_LEARNINGS.md:classnamespackage for className composition...stylespread.legacy.tsfor backward compatibilityTesting
Enhanced test coverage includes:
Success Criteria
Notes
Button.tsx- it's defined separately in multiple locations (Topbar, SidebarControl, ToastNotifications, etc.) and will be handled separately if neededmainbranch - no conflicts with Phase 1.5 (which only touchesGoToTopButton, a separate component)🤖 Generated with Claude Code
Co-Authored-By: Claude Sonnet 4.5 noreply@anthropic.com