Adding hard-coded application header.
This commit is contained in:
@@ -6,6 +6,8 @@ import CourseBreadcrumbs from './CourseBreadcrumbs';
|
||||
import SequenceContainer from './SequenceContainer';
|
||||
import { createSequenceIdList } from '../utils';
|
||||
import AlertList from '../../user-messages/AlertList';
|
||||
import CourseHeader from './CourseHeader';
|
||||
import CourseTabsNavigation from './CourseTabsNavigation';
|
||||
|
||||
export default function Course({
|
||||
courseUsageKey, courseId, sequenceId, unitId, models,
|
||||
@@ -33,26 +35,32 @@ export default function Course({
|
||||
});
|
||||
|
||||
return (
|
||||
<main className="container-fluid d-flex flex-column flex-grow-1">
|
||||
<AlertList topic="course" className="mt-3" />
|
||||
<CourseBreadcrumbs
|
||||
courseUsageKey={courseUsageKey}
|
||||
courseId={courseId}
|
||||
sequenceId={sequenceId}
|
||||
unitId={unitId}
|
||||
models={models}
|
||||
/>
|
||||
<SequenceContainer
|
||||
key={sequenceId}
|
||||
courseUsageKey={courseUsageKey}
|
||||
courseId={courseId}
|
||||
sequenceId={sequenceId}
|
||||
unitId={unitId}
|
||||
models={models}
|
||||
onNext={nextSequenceHandler}
|
||||
onPrevious={previousSequenceHandler}
|
||||
/>
|
||||
</main>
|
||||
<>
|
||||
<CourseHeader courseId={courseId} models={models} />
|
||||
<main className="d-flex flex-column flex-grow-1">
|
||||
<div className="container-fluid">
|
||||
<CourseTabsNavigation className="mb-3" activeTabSlug="course" />
|
||||
<AlertList topic="course" className="mb-3" />
|
||||
<CourseBreadcrumbs
|
||||
courseUsageKey={courseUsageKey}
|
||||
courseId={courseId}
|
||||
sequenceId={sequenceId}
|
||||
unitId={unitId}
|
||||
models={models}
|
||||
/>
|
||||
</div>
|
||||
<SequenceContainer
|
||||
key={sequenceId}
|
||||
courseUsageKey={courseUsageKey}
|
||||
courseId={courseId}
|
||||
sequenceId={sequenceId}
|
||||
unitId={unitId}
|
||||
models={models}
|
||||
onNext={nextSequenceHandler}
|
||||
onPrevious={previousSequenceHandler}
|
||||
/>
|
||||
</main>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
58
src/courseware/course/CourseHeader.jsx
Normal file
58
src/courseware/course/CourseHeader.jsx
Normal file
@@ -0,0 +1,58 @@
|
||||
import React, { useContext } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { Dropdown } from '@edx/paragon';
|
||||
import { getConfig } from '@edx/frontend-platform';
|
||||
import { AppContext } from '@edx/frontend-platform/react';
|
||||
import logo from './logo.svg';
|
||||
|
||||
function LinkedLogo({
|
||||
href,
|
||||
src,
|
||||
alt,
|
||||
...attributes
|
||||
}) {
|
||||
return (
|
||||
<a href={href} {...attributes}>
|
||||
<img className="d-block" src={src} alt={alt} />
|
||||
</a>
|
||||
);
|
||||
}
|
||||
|
||||
LinkedLogo.propTypes = {
|
||||
href: PropTypes.string.isRequired,
|
||||
src: PropTypes.string.isRequired,
|
||||
alt: PropTypes.string.isRequired,
|
||||
};
|
||||
|
||||
export default function CourseHeader({ courseId, models }) {
|
||||
const { authenticatedUser } = useContext(AppContext);
|
||||
const course = models[courseId];
|
||||
return (
|
||||
<header className="container-fluid py-2 d-flex align-items-center border-bottom border-primary">
|
||||
<LinkedLogo
|
||||
className="logo"
|
||||
href={`${getConfig().LMS_BASE_URL}/dashboard`}
|
||||
src={logo}
|
||||
alt={getConfig().SITE_NAME}
|
||||
/>
|
||||
<div className="flex-grow-1" style={{ lineHeight: 1 }}>
|
||||
<span className="d-block small m-0">edX DemoX</span>
|
||||
<span className="d-block m-0 font-weight-bold">{course.displayName}</span>
|
||||
</div>
|
||||
|
||||
<Dropdown>
|
||||
<Dropdown.Button>
|
||||
{authenticatedUser.username}
|
||||
</Dropdown.Button>
|
||||
<Dropdown.Menu>
|
||||
<Dropdown.Item href="#">Resume your last course</Dropdown.Item>
|
||||
<Dropdown.Item href={`${getConfig().LMS_BASE_URL}/dashboard`}>Dashboard</Dropdown.Item>
|
||||
<Dropdown.Item href={`${getConfig().LMS_BASE_URL}/u/${authenticatedUser.username}`}>Profile</Dropdown.Item>
|
||||
<Dropdown.Item href={`${getConfig().LMS_BASE_URL}/account/settings`}>Account</Dropdown.Item>
|
||||
<Dropdown.Item href={getConfig().ORDER_HISTORY_URL}>Order History</Dropdown.Item>
|
||||
<Dropdown.Item href={getConfig().LOGOUT_URL}>Sign Out</Dropdown.Item>
|
||||
</Dropdown.Menu>
|
||||
</Dropdown>
|
||||
</header>
|
||||
);
|
||||
}
|
||||
@@ -1,10 +1,14 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { injectIntl, intlShape } from '@edx/frontend-platform/i18n';
|
||||
import classNames from 'classnames';
|
||||
|
||||
import messages from './messages';
|
||||
import NavTab from './NavTab';
|
||||
|
||||
function CourseTabsNavigation({ activeTabSlug, courseTabs, intl }) {
|
||||
function CourseTabsNavigation({
|
||||
activeTabSlug, courseTabs, intl, className,
|
||||
}) {
|
||||
const courseNavTabs = courseTabs.map(({ slug, ...courseTab }) => (
|
||||
<NavTab
|
||||
isActive={slug === activeTabSlug}
|
||||
@@ -16,7 +20,7 @@ function CourseTabsNavigation({ activeTabSlug, courseTabs, intl }) {
|
||||
return (
|
||||
<nav
|
||||
aria-label={intl.formatMessage(messages['learn.navigation.course.tabs.label'])}
|
||||
className="nav nav-underline-tabs"
|
||||
className={classNames('nav nav-underline-tabs', className)}
|
||||
>
|
||||
{courseNavTabs}
|
||||
</nav>
|
||||
@@ -25,6 +29,7 @@ function CourseTabsNavigation({ activeTabSlug, courseTabs, intl }) {
|
||||
|
||||
CourseTabsNavigation.propTypes = {
|
||||
activeTabSlug: PropTypes.string,
|
||||
className: PropTypes.string,
|
||||
courseTabs: PropTypes.arrayOf(PropTypes.shape({
|
||||
title: PropTypes.string.isRequired,
|
||||
priority: PropTypes.number.isRequired,
|
||||
@@ -36,6 +41,7 @@ CourseTabsNavigation.propTypes = {
|
||||
|
||||
CourseTabsNavigation.defaultProps = {
|
||||
activeTabSlug: undefined,
|
||||
className: null,
|
||||
courseTabs: [
|
||||
{
|
||||
title: 'Course',
|
||||
15
src/courseware/course/logo.svg
Normal file
15
src/courseware/course/logo.svg
Normal file
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="1168px" height="540px" viewBox="0 0 1168 540" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<!-- Generator: Sketch 53.2 (72643) - https://sketchapp.com -->
|
||||
<title>logo</title>
|
||||
<desc>Created with Sketch.</desc>
|
||||
<g id="logo" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<polygon id="Path" fill="#209FDA" fill-rule="nonzero" points="1166.81993 85.5 1166.81993 2.84217094e-14 953.759925 2.84217094e-14 953.759925 85.5 1002.17993 85.5 915.859925 191.98 829.459925 85.5 878.099925 85.5 878.099925 2.84217094e-14 718.919925 2.84217094e-14 718.919925 95.72 856.479925 265.26 718.919925 434.96 718.919925 452.02 784.499925 452.02 784.499925 539.64 878.099925 539.64 878.099925 452.02 823.919925 452.02 915.919925 338.52 915.939925 338.52 1008.03993 452.02 953.759925 452.02 953.759925 539.64 1166.81993 539.64 1166.81993 452.02 1126.85993 452.02 975.319925 265.26 1121.01993 85.5"></polygon>
|
||||
<polygon id="Path" fill="#026BA4" fill-rule="nonzero" points="664.019925 7.10542736e-15 664.019925 85.5 710.619925 85.5 718.919925 95.72 718.919925 7.10542736e-15"></polygon>
|
||||
<polygon id="Path" fill="#026BA4" fill-rule="nonzero" points="718.919925 452.02 718.919925 434.96 705.079925 452.02 664.019925 452.02 664.019925 539.64 784.499925 539.64 784.499925 452.02"></polygon>
|
||||
<path d="M321.999925,411.86 L397.659925,411.86 C388.805702,433.829527 376.258024,454.122269 360.559925,471.86 C344.364089,454.216816 331.320914,433.921419 321.999925,411.86" id="Path" fill="#78212E" fill-rule="nonzero"></path>
|
||||
<path d="M360.559925,189.28 C338.58337,213.190393 322.501981,241.908137 313.599925,273.14 C317.134915,280.039338 320.007771,287.25831 322.179925,294.7 L397.059925,294.7 C399.306706,287.354671 402.25356,280.242036 405.859925,273.46 C397.464721,242.277678 381.959326,213.464341 360.559925,189.28 Z M322.179925,294.7 C328.784599,317.438017 328.978396,341.558795 322.739925,364.4 L396.399925,364.4 C389.855554,341.597488 390.06397,317.386469 396.999925,294.7 L322.179925,294.7 Z M322.179925,294.7 L308.679925,294.7 C304.690779,317.752715 304.575868,341.309464 308.339925,364.4 L322.739925,364.4 C328.978396,341.558795 328.784599,317.438017 322.179925,294.7 L322.179925,294.7 Z" id="Shape" fill="#78212E" fill-rule="nonzero"></path>
|
||||
<path d="M710.619925,85.5 L664.019925,85.5 L664.019925,0.02 L576.019925,0.02 L576.019925,85.5 L632.859925,85.5 L632.859925,159.2 C598.417874,134.487772 557.04992,121.286425 514.659925,121.48 C456.044663,121.405246 400.107354,146.01621 360.559925,189.28 C381.937732,213.470272 397.422343,242.283149 405.799925,273.46 C426.944121,233.500977 468.451514,208.51034 513.659925,208.52 C581.059925,208.52 632.879925,263.16 632.879925,330.52 L632.879925,331.2 C632.539925,398.28 580.879925,452.56 513.659925,452.56 C468.477451,452.593197 426.976426,427.652566 405.799925,387.74 L405.799925,387.74 C401.869213,380.340239 398.718926,372.551658 396.399925,364.5 L308.399925,364.5 C309.686934,372.450225 311.443338,380.317312 313.659925,388.06 C315.970162,396.190434 318.775397,404.171995 322.059925,411.96 L397.659925,411.96 C388.805702,433.929527 376.258024,454.222269 360.559925,471.96 C400.107354,515.22379 456.044663,539.834754 514.659925,539.76 C571.465111,540.091874 625.745998,516.316729 664.019925,474.34 L664.019925,452.04 L705.059925,452.04 L718.899925,434.96 L718.899925,95.74 L710.619925,85.5 Z M632.879925,501.9 L632.879925,539.74 L664.019925,539.74 L664.019925,474.18 C654.623775,484.469293 644.18821,493.758755 632.879925,501.9 L632.879925,501.9 Z M313.599925,273.14 C311.569597,280.231983 309.927163,287.429316 308.679925,294.7 L322.179925,294.7 C320.007771,287.25831 317.134915,280.039338 313.599925,273.14 L313.599925,273.14 Z" id="Shape" fill="#8A8C8F" fill-rule="nonzero"></path>
|
||||
<path d="M410.399925,294.7 C409.199925,287.5 407.659925,280.4 405.799925,273.46 C402.19356,280.242036 399.246706,287.354671 396.999925,294.7 C390.06397,317.386469 389.855554,341.597488 396.399925,364.4 L410.719925,364.4 C414.264276,341.293291 414.156293,317.77319 410.399925,294.7 L410.399925,294.7 Z M209.059925,121.48 C107.422724,121.487508 20.5081632,194.571683 3.05992537,294.7 L91.3999254,294.7 C107.135726,243.467257 154.465065,208.503753 208.059925,208.52 C252.638644,208.335148 293.496156,233.351373 313.599925,273.14 C322.501981,241.908137 338.58337,213.190393 360.559925,189.28 C322.206855,145.880863 266.976617,121.163964 209.059925,121.48 L209.059925,121.48 Z M297.479925,411.86 C275.077969,437.877726 242.392659,452.761934 208.059925,452.58 C153.691226,452.598435 105.87164,416.63791 90.7999254,364.4 L308.339925,364.4 C304.575868,341.309464 304.690779,317.752715 308.679925,294.7 L3.05992537,294.7 C-0.902504563,317.755068 -1.01739385,341.307372 2.71992537,364.4 L2.71992537,364.4 C19.3292424,465.441984 106.661918,539.594765 209.059925,539.6 C266.986094,539.900862 322.217868,515.161403 360.559925,471.74 C344.364089,454.096816 331.320914,433.801419 321.999925,411.74 L297.479925,411.86 Z" id="Shape" fill="#B72768" fill-rule="nonzero"></path>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 5.0 KiB |
@@ -91,15 +91,17 @@ function Sequence({
|
||||
|
||||
return (
|
||||
<div className="d-flex flex-column flex-grow-1">
|
||||
<AlertList topic="sequence" className="mt-3" />
|
||||
<SequenceNavigation
|
||||
onNext={handleNext}
|
||||
onNavigate={handleNavigate}
|
||||
onPrevious={handlePrevious}
|
||||
units={unitsArr}
|
||||
isLocked={isGated}
|
||||
showCompletion={showCompletion}
|
||||
/>
|
||||
<div className="container-fluid">
|
||||
<AlertList topic="sequence" className="mt-3" />
|
||||
<SequenceNavigation
|
||||
onNext={handleNext}
|
||||
onNavigate={handleNavigate}
|
||||
onPrevious={handlePrevious}
|
||||
units={unitsArr}
|
||||
isLocked={isGated}
|
||||
showCompletion={showCompletion}
|
||||
/>
|
||||
</div>
|
||||
{isGated ? (
|
||||
<Suspense fallback={<PageLoading
|
||||
srMessage={intl.formatMessage(messages['learn.loading.content.lock'])}
|
||||
@@ -20,7 +20,7 @@ export default function SequenceNavigation({
|
||||
));
|
||||
|
||||
return (
|
||||
<nav className="flex-grow-0 d-flex w-100 mb-3 btn-group">
|
||||
<nav className="flex-grow-0 d-flex w-100 btn-group">
|
||||
<Button className="btn-outline-primary" onClick={onPrevious}>
|
||||
Previous
|
||||
</Button>
|
||||
@@ -7,16 +7,15 @@ import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import { Route, Switch, Link } from 'react-router-dom';
|
||||
|
||||
import Header, { messages as headerMessages } from '@edx/frontend-component-header';
|
||||
import { messages as headerMessages } from '@edx/frontend-component-header';
|
||||
import Footer, { messages as footerMessages } from '@edx/frontend-component-footer';
|
||||
|
||||
import appMessages from './i18n';
|
||||
import CourseTabsNavigation from './components/CourseTabsNavigation';
|
||||
import LearningSequencePage from './learning-sequence/LearningSequencePage';
|
||||
import UserMessagesProvider from './user-messages/UserMessagesProvider';
|
||||
|
||||
import './index.scss';
|
||||
import './assets/favicon.ico';
|
||||
import CourseContainer from './courseware/CourseContainer';
|
||||
|
||||
function courseLinks() {
|
||||
return (
|
||||
@@ -33,13 +32,16 @@ subscribe(APP_READY, () => {
|
||||
ReactDOM.render(
|
||||
<AppProvider>
|
||||
<UserMessagesProvider>
|
||||
<Header />
|
||||
<div className="container pt-2">
|
||||
<CourseTabsNavigation activeTabSlug="course" />
|
||||
</div>
|
||||
<Switch>
|
||||
<Route exact path="/" render={courseLinks} />
|
||||
<Route path="/course" component={LearningSequencePage} />
|
||||
<Route
|
||||
path={[
|
||||
'/course/:courseUsageKey/:sequenceId/:unitId',
|
||||
'/course/:courseUsageKey/:sequenceId',
|
||||
'/course/:courseUsageKey',
|
||||
]}
|
||||
component={CourseContainer}
|
||||
/>
|
||||
</Switch>
|
||||
<Footer />
|
||||
</UserMessagesProvider>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
@import '~@edx/paragon/scss/edx/theme.scss';
|
||||
|
||||
@import './learning-sequence/index';
|
||||
@import './courseware/index';
|
||||
|
||||
@import "~@edx/frontend-component-header/dist/index";
|
||||
@import "~@edx/frontend-component-footer/dist/footer";
|
||||
@@ -12,6 +12,19 @@
|
||||
|
||||
header {
|
||||
flex: 0;
|
||||
|
||||
.logo {
|
||||
display: block;
|
||||
box-sizing: content-box;
|
||||
position: relative;
|
||||
top: .10em;
|
||||
height: 1.75rem;
|
||||
margin-right: 1rem;
|
||||
img {
|
||||
display: block;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
footer {
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
import React from 'react';
|
||||
import { Switch, Route } from 'react-router';
|
||||
|
||||
import CourseContainer from './CourseContainer';
|
||||
|
||||
export default function LearningSequencePage() {
|
||||
// In spirit, we determine which sort of course we're rendering here based on the URL parameters.
|
||||
// Currently we only have one type, so this file doesn't have much to do.
|
||||
return (
|
||||
<Route
|
||||
path={[
|
||||
'/course/:courseUsageKey/:sequenceId/:unitId',
|
||||
'/course/:courseUsageKey/:sequenceId',
|
||||
'/course/:courseUsageKey',
|
||||
]}
|
||||
component={CourseContainer}
|
||||
/>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user