Phase 7.4b: Migrate Remaining Consumers & Remove Final .legacy Files - #3115
Phase 7.4b: Migrate Remaining Consumers & Remove Final .legacy Files#3115OpenStaxClaude wants to merge 5 commits into
Conversation
dc99ad3 to
a4956b0
Compare
a4956b0 to
b155876
Compare
RoyEJohnson
left a comment
There was a problem hiding this comment.
Can you migrate popUp/FiltersList.tsx away from using styled-components?
RoyEJohnson
left a comment
There was a problem hiding this comment.
Can you migrate popUp/FiltersList.tsx off of styled-components?
|
I've migrated Changes MadeNew File
Modified File
Migration DetailsAll styled-components have been replaced with plain React components using CSS classes:
The component now uses the same pattern as other migrated components in the codebase:
Removed Imports
CI will verify TypeScript compilation and all tests pass. 🤖 Generated with Claude Code |
ac0040f to
b95bfe3
Compare
b95bfe3 to
1e4d51c
Compare
There was a problem hiding this comment.
Pull request overview
This PR completes the Phase 7.4b migration by removing the last styled-components “legacy” CSS-fragment exports (textStyle, disablePrint) and updating remaining popup filter consumers to use plain CSS (including adding a dedicated FiltersList.css).
Changes:
- Migrates
FiltersListstyling from styled-components fragments to a plain CSS file and class-based styling. - Removes deprecated legacy exports and deletes the final
.legacy.tsfiles (Typography.legacy.ts,disablePrint.legacy.ts). - Updates Jest snapshots across multiple popup/filter consumers to reflect new class names and generated styled-component identifiers.
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/app/content/studyGuides/components/snapshots/Filters.spec.tsx.snap | Snapshot updates reflecting new FiltersList markup/classes and CSS output. |
| src/app/content/practiceQuestions/components/snapshots/PracticeQuestionsPopup.spec.tsx.snap | Snapshot updates for updated print selector / styled-components identifiers. |
| src/app/content/practiceQuestions/components/snapshots/Filters.spec.tsx.snap | Snapshot updates for updated print selector / styled-components identifiers. |
| src/app/content/highlights/components/SummaryPopup/snapshots/Filters.spec.tsx.snap | Snapshot updates reflecting new FiltersList markup/classes and CSS output. |
| src/app/content/components/utils/disablePrint.ts | Removes deprecated re-export; leaves only disablePrintClass. |
| src/app/content/components/utils/disablePrint.legacy.ts | Deletes legacy styled-components disablePrint fragment. |
| src/app/content/components/Topbar/snapshots/index.spec.tsx.snap | Snapshot updates due to CSS output changes. |
| src/app/content/components/popUp/FiltersList.tsx | Refactors FiltersList to plain React + class-based styling, keeping a styled wrapper for selector compatibility. |
| src/app/content/components/popUp/FiltersList.css | New CSS stylesheet for FiltersList classes (close button, labels, container, etc.). |
| src/app/content/components/popUp/Filters.tsx | Replaces textStyle and disablePrint fragment usage with direct color and inline print media CSS. |
| src/app/content/components/popUp/ColorFilter.tsx | Replaces textStyle usage with direct color styling. |
| src/app/content/components/popUp/ChapterFilter.tsx | Replaces textStyle usage with direct color styling. |
| src/app/content/components/popUp/snapshots/Filters.spec.tsx.snap | Snapshot updates reflecting new FiltersList markup/classes and CSS output. |
| src/app/content/components/snapshots/AssignedTopBar.spec.tsx.snap | Snapshot updates due to CSS output changes. |
| src/app/content/snapshots/routes.spec.tsx.snap | Snapshot updates due to CSS output changes. |
| src/app/components/Typography/Typography.legacy.ts | Deletes legacy styled-components textStyle fragment. |
| src/app/components/Typography/index.ts | Removes legacy textStyle re-export and related guidance. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This comment was marked as resolved.
This comment was marked as resolved.
0be3667 to
ce90d6a
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 17 out of 17 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
src/app/content/components/popUp/FiltersList.tsx:160
FiltersListBasealways prepends thefilters-listclass, but at least one consumer already passesclassName="filters-list"(e.g.studyGuides/components/Filters.tsx), which results in duplicated class tokens like"filters-list … filters-list"in the DOM/snapshots. This is harmless but noisy and can complicate class-based selectors.
<ul
className={classNames('filters-list', className)}
aria-live='polite'
aria-atomic='true'
ce90d6a to
a210a79
Compare
…final .legacy files
This PR completes the styled-components to plain CSS migration by migrating the remaining consumers of legacy styled-components exports and removing the final .legacy files.
## Migrated Files (6 files)
### PopUp Filter Components
- **ChapterFilter.tsx**: Replaced `textStyle` css fragment with direct `color: ${theme.color.text.default}`
- **ColorFilter.tsx**: Replaced `textStyle` css fragment with direct color styling
- **Filters.tsx**: Replaced `textStyle` and `disablePrint` with direct CSS
- **FiltersList.tsx**: Replaced `textStyle` and `disablePrint` with direct CSS
All filter components now use direct theme color references instead of styled-components css fragments.
### Typography Module
- **Typography/index.ts**: Removed `textStyle` legacy re-export
- **Removed Typography.legacy.ts**: Deleted legacy css fragment file
### DisablePrint Utility
- **disablePrint.ts**: Removed `disablePrint` legacy re-export
- **Removed disablePrint.legacy.ts**: Deleted legacy css fragment file
## Changes Summary
- 2 .legacy files deleted (Typography.legacy.ts, disablePrint.legacy.ts)
- 6 files updated to remove styled-components css fragment usage
- Replaced `textStyle` (color: ${theme.color.text.default}) with direct color styling
- Replaced `disablePrint` (@media print { display: none; }) with inline CSS
## Verification
- ✅ Zero .legacy.ts files remain in codebase
- ✅ All styled-components css fragments replaced with direct CSS
- ⏳ CI will verify TypeScript compilation
- ⏳ CI will run full test suite
This PR builds on #3113 (Phase 7.4a) and must be merged after 7.4a.
Related to: CORE-2285
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit addresses the code review feedback by migrating the FiltersList component from styled-components to plain CSS, following the same pattern used in earlier migration phases. Changes: - Created FiltersList.css with all component styles - Replaced styled-components with plain React components using CSS classes - Removed unused imports (css from styled-components, theme, hiddenButAccessible) - Kept styled() wrappers for backward compatibility with component selectors in Filters.tsx - All styles now use direct CSS classes instead of styled-components Components migrated: - StyledPlainButton → .filters-list-close-button - ItemLabel → .filters-list-item-label - FilterListItem → .filters-list-item - StatusDiv → .filters-list-status - FiltersList → .filters-list The component maintains the same visual appearance and functionality while removing all styled-components CSS-in-JS usage except for the empty styled() wrappers needed for backward compatibility. 🤖 Generated with [Claude Code](https://claude.com/claude-code) snaps Use classNames Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
…ession
This commit addresses the three issues raised by GitHub Copilot:
1. **Fixed StyledPlainButtonBase className override** (Comment 2/3)
- StyledPlainButtonBase now properly merges styled-components' generated className
- Changed from overwriting className to using classNames('filters-list-close-button', className)
- This preserves backward compatibility with component selectors
2. **Fixed Filters.tsx color regression** (Comment 1/3)
- Restored the correct toggle text color to theme.color.primary.gray.base
- The previous change incorrectly used theme.color.text.default
- Original code had textStyle (text.default) overridden by gray.base - we were missing the override
3. **FiltersListBase className handling** (Comment 3/3)
- The classNames('filters-list', className) pattern is correct and matches other migrated components
- This ensures base styles are always applied while preserving styled-components className
All changes maintain visual consistency with the original implementation while supporting the migration to plain CSS.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
snaps
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
a210a79 to
545421f
Compare
Summary
This PR builds on #3113 (Phase 7.4a) by migrating the remaining styled-components consumers and removing the final
.legacy.tsfiles from the codebase.Base branch:
phase-7.4a-remove-legacy-files(PR #3113)Related Jira ticket: CORE-2285
Background
PR #3113 removed most
.legacyfiles but kept 2 files (Typography.legacy.tsanddisablePrint.legacy.ts) because several components were still importing from them. This PR completes the migration by:.legacyfilesChanges
Migrated Components (6 files)
PopUp Filter Components
All filter components were using
textStyle(a styled-components css fragment that setcolor: ${theme.color.text.default}) and/ordisablePrint(css fragment for@media print { display: none; }).ChapterFilter.tsx
textStyleimport${textStyle}with directcolor: ${theme.color.text.default}ColorFilter.tsx
textStyleimport${textStyle}with direct color stylingFilters.tsx
textStyleanddisablePrintimports${textStyle}with direct color${disablePrint}with inline@media print { display: none; }FiltersList.tsx
textStyleanddisablePrintimportsDeleted Files (2 files)
Removed
src/app/components/Typography/Typography.legacy.tstextStylecss fragmentRemoved
src/app/content/components/utils/disablePrint.legacy.tsdisablePrintcss fragmentUpdated Module Exports (2 files)
Typography/index.ts
textStylere-exportdisablePrint.ts
disablePrintre-exportdisablePrintClassconstantCode Statistics
Verification
.legacy.tsfiles remain in codebasetextStyleusages replaced with direct color stylingdisablePrintusages replaced with inline CSSMerge Order
This PR must be merged after #3113 since it's based on the
phase-7.4a-remove-legacy-filesbranch.🤖 Generated with Claude Code