Skip to content

Commit b2f74c6

Browse files
Migrate ShowStudyGuides component to plain CSS
Migrate ShowStudyGuides.tsx from styled-components to plain CSS: ✅ ShowStudyGuides (StudyGuidesBody) - Created ShowStudyGuides.css with study-guides-specific styling - Replaced styled(PopupBody) with direct PopupBody usage + className - Bind theme background color as CSS variable (--study-guides-bg) - Convert mobile breakpoint to standard media query (max-width: 75em) - Preserve print styles (white background, FiltersList padding) - Export PopupBody as StudyGuidesBody for test compatibility Migration follows the hybrid approach from PLAIN_CSS_MIGRATION_GUIDE.md Related: CORE-1704 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent cf3063e commit b2f74c6

2 files changed

Lines changed: 38 additions & 19 deletions

File tree

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/* ShowStudyGuides.css - Plain CSS migration from styled-components */
2+
3+
/* StudyGuidesBody: Extends PopupBody with study-guides-specific styling */
4+
.study-guides-body {
5+
/* Override PopupBody background for study guides */
6+
background: var(--study-guides-bg);
7+
}
8+
9+
/* Mobile responsive styles (max-width: 75em / 1200px) */
10+
@media screen and (max-width: 75em) {
11+
.study-guides-body {
12+
text-align: left;
13+
padding: 0;
14+
}
15+
}
16+
17+
/* Print styles */
18+
@media print {
19+
.study-guides-body {
20+
background: white;
21+
}
22+
23+
/* Nested component styling: FiltersList should have no left padding in print */
24+
.study-guides-body .filters-list {
25+
padding-left: 0;
26+
}
27+
}

src/app/content/studyGuides/components/ShowStudyGuides.tsx

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
import { HTMLElement } from '@openstax/types/lib.dom';
22
import React from 'react';
33
import { useDispatch, useSelector } from 'react-redux';
4-
import styled, { css } from 'styled-components/macro';
4+
import classNames from 'classnames';
55
import GoToTopButton from '../../../components/GoToTopButton';
66
import theme from '../../../theme';
7-
import FiltersList from '../../components/popUp/FiltersList';
87
import { loadMoreDistanceFromBottom } from '../../constants';
98
import { PopupBody } from '../../styles/PopupStyles';
109
import { loadMoreStudyGuides } from '../actions';
@@ -13,22 +12,11 @@ import Filters from './Filters';
1312
import StudyGuides from './StudyGuides';
1413
import StudyGuidesCTA from './StudyGuidesCTA';
1514
import StudyGuidesToasts from './StudyGuidesToasts';
15+
import './ShowStudyGuides.css';
1616

17-
export const StudyGuidesBody = styled(PopupBody)`
18-
background: ${theme.color.neutral.darker};
19-
${theme.breakpoints.mobile(css`
20-
text-align: left;
21-
padding: 0;
22-
`)}
23-
24-
@media print {
25-
background: white;
26-
27-
${FiltersList} {
28-
padding-left: 0;
29-
}
30-
}
31-
`;
17+
// Export PopupBody as StudyGuidesBody for test compatibility
18+
// The actual styling is now in ShowStudyGuides.css
19+
export const StudyGuidesBody = PopupBody;
3220

3321
const ShowStudyGuides = ({topElRef}: {topElRef: React.RefObject<HTMLElement>}) => {
3422
const ref = React.useRef<HTMLElement>(null);
@@ -68,8 +56,12 @@ const ShowStudyGuides = ({topElRef}: {topElRef: React.RefObject<HTMLElement>}) =
6856
};
6957

7058
return (
71-
<StudyGuidesBody
59+
<PopupBody
7260
ref={ref}
61+
className={classNames('study-guides-body')}
62+
style={{
63+
'--study-guides-bg': theme.color.neutral.darker,
64+
} as React.CSSProperties}
7365
onScroll={() => {
7466
const refElement = ref.current;
7567

@@ -92,7 +84,7 @@ const ShowStudyGuides = ({topElRef}: {topElRef: React.RefObject<HTMLElement>}) =
9284
onClick={goToTop}
9385
data-testid='back-to-top-studyguides'
9486
/>}
95-
</StudyGuidesBody>
87+
</PopupBody>
9688
);
9789
};
9890

0 commit comments

Comments
 (0)