-
Notifications
You must be signed in to change notification settings - Fork 43
/
App.jsx
executable file
·60 lines (53 loc) · 1.5 KB
/
App.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { BrowserRouter as Router } from 'react-router-dom';
import FooterSlot from '@openedx/frontend-slot-footer';
import { LearningHeader as Header } from '@edx/frontend-component-header';
import { selectors } from 'data/redux';
import DemoWarning from 'containers/DemoWarning';
import CTA from 'containers/CTA';
import NotificationsBanner from 'containers/NotificationsBanner';
import ListView from 'containers/ListView';
import './App.scss';
import Head from './components/Head';
export const App = ({ courseMetadata, isEnabled }) => (
<Router>
<div>
<Head />
<Header
courseTitle={courseMetadata.title}
courseNumber={courseMetadata.number}
courseOrg={courseMetadata.org}
data-testid="header"
/>
{!isEnabled && <DemoWarning />}
<CTA />
<NotificationsBanner />
<main data-testid="main">
<ListView />
</main>
<FooterSlot />
</div>
</Router>
);
App.defaultProps = {
courseMetadata: {
title: '',
number: null,
org: '',
},
};
App.propTypes = {
courseMetadata: PropTypes.shape({
title: PropTypes.string,
number: PropTypes.string,
org: PropTypes.string,
}),
isEnabled: PropTypes.bool.isRequired,
};
export const mapStateToProps = (state) => ({
courseMetadata: selectors.app.courseMetadata(state),
isEnabled: selectors.app.isEnabled(state),
});
export default connect(mapStateToProps)(App);