-
Notifications
You must be signed in to change notification settings - Fork 245
/
Copy pathCourseHandouts.jsx
41 lines (34 loc) · 1.07 KB
/
CourseHandouts.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import React from 'react';
import { useSelector } from 'react-redux';
import { useWindowSize, breakpoints } from '@openedx/paragon';
import classNames from 'classnames';
import { injectIntl, intlShape } from '@edx/frontend-platform/i18n';
import LmsHtmlFragment from '../LmsHtmlFragment';
import messages from '../messages';
import { useModel } from '../../../generic/model-store';
const CourseHandouts = ({ intl }) => {
const {
courseId,
} = useSelector(state => state.courseHome);
const {
handoutsHtml,
} = useModel('outline', courseId);
const wideScreen = useWindowSize().width >= breakpoints.medium.minWidth;
if (!handoutsHtml) {
return null;
}
return (
<section className="mb-4">
<h2 className="h4">{intl.formatMessage(messages.handouts)}</h2>
<LmsHtmlFragment
className={classNames({ small: !wideScreen })}
html={handoutsHtml}
title={intl.formatMessage(messages.handouts)}
/>
</section>
);
};
CourseHandouts.propTypes = {
intl: intlShape.isRequired,
};
export default injectIntl(CourseHandouts);