Skip to content

Commit 2338412

Browse files
Merge branch 'staging' into c58-youtube-api-integration
2 parents b04e10b + 8cf965d commit 2338412

File tree

9 files changed

+88
-7
lines changed

9 files changed

+88
-7
lines changed

src/components/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export { default as CourseInfo } from './course/CourseInfo';
1010
// ========================================
1111
// lesson
1212
export { default as LessonInfo } from './lesson/LessonInfo';
13+
export { default as LessonNav } from './lesson/LessonNav';
1314
export { default as LessonVideo } from './lesson/LessonVideo';
1415
export { default as LessonLink } from './lesson/LessonLink';
1516
export { default as LessonsPane } from './lesson/LessonsPane';

src/components/lesson/Lesson.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ import PropTypes from 'prop-types';
55
import { LessonVideo, LessonInfo } from '..';
66
import '../../css/lesson/Lesson.scss';
77

8-
const Lesson = ({ title, src, description, order }) => (
8+
const Lesson = ({ title, src, description, order, course_size, base_path }) => (
99
<div className="lesson" key={order}>
1010
{/* <YouTube videoId={} opts={} onEnd={} /> */}
1111
<LessonVideo title={title} src={src} />
12-
<LessonInfo title={title} description={description} />
12+
<LessonInfo title={title} order={order} description={description} course_size={course_size} base_path={base_path} />
1313
</div>
1414
);
1515

@@ -18,6 +18,8 @@ Lesson.propTypes = {
1818
src: PropTypes.string.isRequired,
1919
description: PropTypes.string.isRequired,
2020
order: PropTypes.number.isRequired,
21+
course_size: PropTypes.number.isRequired,
22+
base_path: PropTypes.string.isRequired,
2123
};
2224

2325
export default Lesson;

src/components/lesson/LessonInfo.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
import React from 'react';
2+
import { LessonNav } from '..';
23
import PropTypes from 'prop-types';
34
import '../../css/lesson/LessonInfo.scss';
45

56
// TODO: add content channel link
67
// TODO: add description about channel and text from actual video
78
// TODO: add next and previous lesson buttons
8-
const LessonInfo = ({ title, description }) => (
9+
const LessonInfo = ({ title, description, order, base_path, course_size }) => (
910
<div className="lesson-info">
11+
<LessonNav order={order} base_path={base_path} course_size={course_size} />
1012
<h4 id="lesson-playing">Now playing:</h4>
1113
<h2>{title || 'Lesson'}</h2>
1214
<hr />
@@ -17,6 +19,9 @@ const LessonInfo = ({ title, description }) => (
1719
LessonInfo.propTypes = {
1820
title: PropTypes.string.isRequired,
1921
description: PropTypes.string.isRequired,
22+
order: PropTypes.number.isRequired,
23+
base_path: PropTypes.string.isRequired,
24+
course_size: PropTypes.number.isRequired,
2025
};
2126

2227
export default LessonInfo;

src/components/lesson/LessonNav.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import React from 'react';
2+
import { Link } from 'react-router-dom';
3+
import PropTypes from 'prop-types';
4+
import '../../css/lesson/LessonNav.scss';
5+
6+
const LessonNav = ({order, base_path, course_size}) => (
7+
<div className="lesson-nav">
8+
{ order !== 0
9+
? <button type="button" className='btn prev-btn'>
10+
<Link to={`/courses/${base_path}/${order - 1}`} >← Prev</Link>
11+
</button>
12+
: ''}
13+
{ order !== course_size - 1
14+
? <button type="button" className="btn next-btn">
15+
<Link to={`/courses/${base_path}/${order + 1}`}>Next →</Link>
16+
</button>
17+
: ''}
18+
</div>
19+
);
20+
21+
LessonNav.propTypes = {
22+
order: PropTypes.number.isRequired,
23+
base_path: PropTypes.string.isRequired,
24+
course_size: PropTypes.number.isRequired,
25+
};
26+
27+
export default LessonNav;

src/components/pages/LessonPage.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,18 @@ function LessonPage(props) {
77
const { curr_lesson_num, lessons, base_path, course_title } = props;
88
// const { title, src, description, id } = lessons.find(elem => elem.id === activeId);
99
const { title, src, description, order } = lessons[curr_lesson_num];
10+
const total = lessons.length;
1011

1112
return (
1213
<div className="lesson-page">
13-
<Lesson order={order} title={title} src={src} description={description} />
14+
<Lesson
15+
order={order}
16+
title={title}
17+
src={src}
18+
description={description}
19+
course_size={total}
20+
base_path={base_path}
21+
/>
1422
<LessonsPane
1523
course_title={course_title}
1624
lessons={lessons}

src/css/lesson/Lesson.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@import '../VARIABLES.scss';
22

33
.lesson {
4-
margin: 1rem 3rem;
4+
margin-right: 2rem;
55
}
66

77

src/css/lesson/LessonNav.scss

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
.lesson-nav {
2+
margin-top: -1rem;
3+
margin-bottom: 2rem;
4+
5+
.btn {
6+
border: none;
7+
8+
a {
9+
font-family: var(--fontfamily);
10+
background-color: var(--navy);
11+
font-size: 1rem;
12+
height: 100%;
13+
width: 100%;
14+
color:var(--cream);
15+
text-decoration: none;
16+
padding: 0.75rem 1.5rem;
17+
}
18+
19+
a:hover {
20+
background-color: var(--brown);
21+
}
22+
}
23+
24+
.prev-btn {
25+
float: left;
26+
}
27+
28+
.next-btn {
29+
float: right;
30+
}
31+
}
32+
33+
.lesson-nav:after {
34+
content: '';
35+
display: block;
36+
clear: both;
37+
}

src/css/lesson/LessonsPane.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
.lessons-pane {
44
background-color: var(--white);
55
min-width: 30%;
6-
margin: 1rem;
76
border: solid var(--blue) 2px;
87
flex: 1 0 30%;
98
}
@@ -13,4 +12,5 @@
1312
padding: 1rem;
1413
font-weight: bold;
1514
color: var(--white);
16-
}
15+
font-size: calc(16px + 1vw);
16+
}

src/css/pages/LessonPage.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
.lesson-page {
99
display: flex;
10+
padding: 3rem;
1011
}
1112

1213
.lesson-page > * {

0 commit comments

Comments
 (0)