-
Notifications
You must be signed in to change notification settings - Fork 192
Expand file tree
/
Copy pathMainLayout.jsx
More file actions
70 lines (63 loc) · 1.98 KB
/
MainLayout.jsx
File metadata and controls
70 lines (63 loc) · 1.98 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import PropTypes from 'prop-types';
import { Container, Layout } from '@openedx/paragon';
import { useIntl } from '@edx/frontend-platform/i18n';
import { SavingErrorAlert } from '../../generic/saving-error-alert';
import SubHeader from '../../generic/sub-header/SubHeader';
import messages from '../messages';
import CertificatesSidebar from './certificates-sidebar/CertificatesSidebar';
import HeaderButtons from './header-buttons/HeaderButtons';
import useLayout from './hooks/useLayout';
const MainLayout = ({ courseId, showHeaderButtons, children }) => {
const intl = useIntl();
const {
errorMessage,
savingStatus,
} = useLayout();
return (
<>
<Container size="xl" className="certificates px-4">
<div className="mt-5" />
<SubHeader
hideBorder
title={intl.formatMessage(messages.headingTitle)}
subtitle={intl.formatMessage(messages.headingSubtitle)}
headerActions={showHeaderButtons && <HeaderButtons />}
/>
<section>
<Layout
lg={[{ span: 9 }, { span: 3 }]}
md={[{ span: 9 }, { span: 3 }]}
sm={[{ span: 9 }, { span: 3 }]}
xs={[{ span: 9 }, { span: 3 }]}
xl={[{ span: 9 }, { span: 3 }]}
>
<Layout.Element>
<article role="main">
{children}
</article>
</Layout.Element>
<Layout.Element>
<CertificatesSidebar courseId={courseId} />
</Layout.Element>
</Layout>
</section>
</Container>
<div className="certificates alert-toast">
<SavingErrorAlert
savingStatus={savingStatus}
errorMessage={errorMessage}
/>
</div>
</>
);
};
MainLayout.defaultProps = {
showHeaderButtons: false,
children: null,
};
MainLayout.propTypes = {
courseId: PropTypes.string.isRequired,
showHeaderButtons: PropTypes.bool,
children: PropTypes.node,
};
export default MainLayout;