Skip to content

Commit 97122da

Browse files
committed
fix: theme fixes for course info page
1 parent 9518b3d commit 97122da

File tree

3 files changed

+74
-13
lines changed

3 files changed

+74
-13
lines changed

src/learningpath/CourseDetails.jsx

+43-11
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,17 @@ import {
2020
Calendar,
2121
Person,
2222
Close,
23+
ChevronLeft,
2324
} from '@openedx/paragon/icons';
2425
import { useCourseDetail } from './data/queries';
2526
import { buildAssetUrl } from '../util/assetUrl';
2627

27-
const CourseDetailContent = ({ course, isModalView, onClose }) => {
28+
const CourseDetailContent = ({
29+
course,
30+
isModalView,
31+
onClose,
32+
learningPathTitle,
33+
}) => {
2834
const {
2935
name,
3036
shortDescription,
@@ -70,19 +76,31 @@ const CourseDetailContent = ({ course, isModalView, onClose }) => {
7076
<div className="hero-section p-4">
7177
{!isModalView && (
7278
<div className="mb-3">
73-
<Link to="/" style={{ fontWeight: 600 }}>Explore</Link>
79+
<Link to="/" style={{ fontWeight: 600 }} className="d-flex">
80+
<Icon src={ChevronLeft} />
81+
<span>Go Back</span>
82+
</Link>
7483
</div>
7584
)}
7685
{isModalView && (
77-
<div className="pgn__modal-close-container">
78-
<ModalCloseButton variant="tertiary" onClick={handleClose}>
79-
<Icon src={Close} />
80-
</ModalCloseButton>
81-
</div>
86+
<>
87+
<div className="lp-course-modal-header d-flex align-items-center justify-content-between py-2">
88+
{learningPathTitle && (
89+
<h5 className="mb-0">
90+
Learning Path: {learningPathTitle}
91+
</h5>
92+
)}
93+
<div className="pgn__modal-close-container">
94+
<ModalCloseButton variant="tertiary" onClick={handleClose}>
95+
<Icon src={Close} />
96+
</ModalCloseButton>
97+
</div>
98+
</div>
99+
</>
82100
)}
83-
<Row>
101+
<Row className="border-bottom border-light">
84102
<Col xs={12} md={8}>
85-
<div className="course-type-label text-uppercase mb-2">
103+
<div className="course-detail-type-label d-flex text-uppercase mb-2">
86104
<Icon src={LmsBook} className="mr-1" />
87105
<span>Course</span>
88106
</div>
@@ -185,14 +203,21 @@ CourseDetailContent.propTypes = {
185203
}).isRequired,
186204
isModalView: PropTypes.bool,
187205
onClose: PropTypes.func,
206+
learningPathTitle: PropTypes.string,
188207
};
189208

190209
CourseDetailContent.defaultProps = {
191210
isModalView: false,
192211
onClose: undefined,
212+
learningPathTitle: undefined,
193213
};
194214

195-
const CourseDetailPage = ({ isModalView = false, onClose, courseKey: propCourseKey }) => {
215+
const CourseDetailPage = ({
216+
isModalView = false,
217+
onClose,
218+
courseKey: propCourseKey,
219+
learningPathTitle,
220+
}) => {
196221
const { courseKey: urlCourseKey } = useParams();
197222
const courseKey = propCourseKey || urlCourseKey;
198223

@@ -236,7 +261,12 @@ const CourseDetailPage = ({ isModalView = false, onClose, courseKey: propCourseK
236261

237262
return (
238263
<div className="course-detail-page">
239-
<CourseDetailContent course={courseWithFallbacks} isModalView={isModalView} onClose={onClose} />
264+
<CourseDetailContent
265+
course={courseWithFallbacks}
266+
isModalView={isModalView}
267+
onClose={onClose}
268+
learningPathTitle={learningPathTitle}
269+
/>
240270
</div>
241271
);
242272
};
@@ -245,12 +275,14 @@ CourseDetailPage.propTypes = {
245275
isModalView: PropTypes.bool,
246276
onClose: PropTypes.func,
247277
courseKey: PropTypes.string,
278+
learningPathTitle: PropTypes.string,
248279
};
249280

250281
CourseDetailPage.defaultProps = {
251282
isModalView: false,
252283
onClose: undefined,
253284
courseKey: undefined,
285+
learningPathTitle: undefined,
254286
};
255287

256288
export default CourseDetailPage;

src/learningpath/LearningPathDetails.jsx

+9-2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import CourseDetailPage from './CourseDetails';
1919
const LearningPathDetailPage = () => {
2020
const { key } = useParams();
2121
const [selectedCourseKey, setSelectedCourseKey] = useState(null);
22+
const [selectedPathTitle, setSelectedPathTitle] = useState('');
2223

2324
const {
2425
data: detail,
@@ -51,12 +52,14 @@ const LearningPathDetailPage = () => {
5152
return maxDate;
5253
}, [coursesForPath]);
5354

54-
const handleOpenCourseModal = (courseKey) => {
55+
const handleOpenCourseModal = (courseKey, pathTitle) => {
5556
setSelectedCourseKey(courseKey);
57+
setSelectedPathTitle(pathTitle);
5658
};
5759

5860
const handleCloseCourseModal = () => {
5961
setSelectedCourseKey(null);
62+
setSelectedPathTitle('');
6063
};
6164

6265
let content;
@@ -204,7 +207,10 @@ const LearningPathDetailPage = () => {
204207
<CourseCard
205208
course={course}
206209
parentPath=""
207-
onClick={() => handleOpenCourseModal(course.courseId ? `course-v1:${course.org}+${course.courseId}+${course.run}` : null)}
210+
onClick={() => handleOpenCourseModal(
211+
course.courseId ? `course-v1:${course.org}+${course.courseId}+${course.run}` : null,
212+
displayName,
213+
)}
208214
/>
209215
</div>
210216
))
@@ -237,6 +243,7 @@ const LearningPathDetailPage = () => {
237243
isModalView
238244
courseKey={selectedCourseKey}
239245
onClose={handleCloseCourseModal}
246+
learningPathTitle={selectedPathTitle}
240247
/>
241248
</ModalLayer>
242249
)}

src/learningpath/index.css

+22
Original file line numberDiff line numberDiff line change
@@ -405,3 +405,25 @@
405405
font-weight: 600;
406406
margin-bottom: 1.5rem !important;
407407
}
408+
409+
.course-detail-type-label {
410+
color: white;
411+
align-items: center;
412+
font-size: 0.85rem;
413+
font-weight: 600;
414+
background-color: #8C8179;
415+
border-radius: 5px;
416+
padding: 2px 2px;
417+
max-width: 6rem;
418+
}
419+
420+
.lp-course-modal-header {
421+
position: absolute;
422+
top: 0 !important;
423+
424+
.pgn__modal-close-container {
425+
position: relative !important;
426+
top: 0 !important;
427+
margin-left: 66vw;
428+
}
429+
}

0 commit comments

Comments
 (0)