Skip to content

Commit 938b5be

Browse files
authored
Merge pull request #78 from talent-path-pipeline/73-yt-lesson-details
73 yt lesson details
2 parents 3e2c925 + e65fcab commit 938b5be

File tree

7 files changed

+90
-37
lines changed

7 files changed

+90
-37
lines changed

src/DUMMY_DATA.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,11 @@ const make_rules = {
7373
length: 'PT3H9M7S',
7474
title: 'You Make the Rules!',
7575
description: `The published D&D sourcebooks have their fair share of suggested rules... but as the DM, you have the special privilege to bend those to your will! Learn in this video how to set house rules for your campaign and your world, and begin collecting these guidelines in a Player's Guide for your party.`,
76+
yt_chan_name: 'Nerdarchy',
77+
yt_chan_src: 'https://www.youtube.com/channel/UCHLzgnQu3OWn31g2PebQV5Q',
78+
yt_title: 'How to Use House Rules in Your D&D Campaign| Game Master Tips',
79+
yt_desc: 'formatted youtube description',
80+
7681
};
7782

7883
const expectations = {

src/components/lesson/Lesson.js

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

8-
const Lesson = ({ title, src, description, order, course_size, base_path }) => (
9-
<div className="lesson" key={order}>
10-
{/* <YouTube videoId={} opts={} onEnd={} /> */}
11-
<LessonVideo title={title} src={src} />
12-
<LessonInfo title={title} order={order} description={description} course_size={course_size} base_path={base_path} />
8+
const Lesson = ({ lesson, course_size, base_path }) => (
9+
<div className="lesson" key={lesson.order}>
10+
<LessonVideo title={lesson.title} src={lesson.src} />
11+
<LessonInfo lesson={lesson} course_size={course_size} base_path={base_path} />
1312
</div>
1413
);
1514

1615
Lesson.propTypes = {
17-
title: PropTypes.string.isRequired,
18-
src: PropTypes.string.isRequired,
19-
description: PropTypes.string.isRequired,
20-
order: PropTypes.number.isRequired,
16+
lesson: PropTypes.shape({
17+
title: PropTypes.string.isRequired,
18+
src: PropTypes.string.isRequired,
19+
description: PropTypes.string.isRequired,
20+
order: PropTypes.number.isRequired,
21+
yt_chan_name: PropTypes.string.isRequired,
22+
yt_chan_src: PropTypes.string.isRequired,
23+
yt_title: PropTypes.string.isRequired,
24+
yt_desc: PropTypes.string.isRequired,
25+
}).isRequired,
2126
course_size: PropTypes.number.isRequired,
2227
base_path: PropTypes.string.isRequired,
2328
};

src/components/lesson/LessonInfo.js

Lines changed: 42 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,50 @@ import { LessonNav } from '..';
33
import PropTypes from 'prop-types';
44
import '../../css/lesson/LessonInfo.scss';
55

6-
// TODO: add content channel link
7-
// TODO: add description about channel and text from actual video
8-
// TODO: add next and previous lesson buttons
9-
const LessonInfo = ({ title, description, order, base_path, course_size }) => (
10-
<div className="lesson-info">
11-
<LessonNav order={order} base_path={base_path} course_size={course_size} />
12-
<h4 id="lesson-playing">Now playing:</h4>
13-
<h2>{title || 'Lesson'}</h2>
14-
<hr />
15-
<p id="lesson-description">{description || 'No description provided'}</p>
16-
</div>
17-
);
6+
const getVideoURL = embedLink => embedLink.replace('embed/', 'watch?v=');
7+
8+
const LessonInfo = ({ lesson, base_path, course_size }) => {
9+
const {title, description, order, src, yt_chan_name, yt_chan_src, yt_title, yt_desc} = lesson;
10+
11+
return (
12+
<div className="lesson-info">
13+
<LessonNav order={order} base_path={base_path} course_size={course_size} />
14+
<h4 id="lesson-playing">Now playing:</h4>
15+
<h2>{title || 'Lesson'}</h2>
16+
<hr />
17+
<p id="lesson-description">{description || 'No description provided'}</p>
18+
<hr />
19+
20+
<div id="yt-info">
21+
<h3 className="subheader">Youtube credits</h3>
22+
<p id="yt-chan">
23+
<span className="title">Creator: </span>
24+
<a href={yt_chan_src} target="_blank" rel="noopener noreferrer">{yt_chan_name || 'YouTube Channel goes here'}</a>
25+
</p>
26+
<p id="yt-title">
27+
<span className="title">Video title: </span>
28+
<a href={getVideoURL(src)} target="_blank" rel="noopener noreferrer">{yt_title || 'Original YouTube Video'}</a>
29+
</p>
30+
<p id="yt-desc">
31+
<span className="title">Video Description: </span>
32+
{yt_desc || 'YouTube description goes here'}
33+
</p>
34+
</div>
35+
</div>
36+
);
37+
};
1838

1939
LessonInfo.propTypes = {
20-
title: PropTypes.string.isRequired,
21-
description: PropTypes.string.isRequired,
22-
order: PropTypes.number.isRequired,
40+
lesson: PropTypes.shape({
41+
title: PropTypes.string.isRequired,
42+
src: PropTypes.string.isRequired,
43+
description: PropTypes.string.isRequired,
44+
order: PropTypes.number.isRequired,
45+
yt_chan_name: PropTypes.string.isRequired,
46+
yt_chan_src: PropTypes.string.isRequired,
47+
yt_title: PropTypes.string.isRequired,
48+
yt_desc: PropTypes.string.isRequired,
49+
}).isRequired,
2350
base_path: PropTypes.string.isRequired,
2451
course_size: PropTypes.number.isRequired,
2552
};

src/components/lesson/LessonLink.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ const LessonLink = ({ title, length, order, active, base_path }) => {
4141
LessonLink.propTypes = {
4242
title: PropTypes.string.isRequired,
4343
order: PropTypes.number.isRequired,
44-
length: PropTypes.number.isRequired,
44+
length: PropTypes.string.isRequired,
4545
active: PropTypes.bool.isRequired,
4646
base_path: PropTypes.string.isRequired,
4747
};

src/components/lesson/LessonsPane.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ LessonsPane.propTypes = {
2727
PropTypes.shape({
2828
order: PropTypes.number.isRequired,
2929
title: PropTypes.string.isRequired,
30-
length: PropTypes.number.isRequired,
30+
length: PropTypes.string.isRequired,
3131
}),
3232
).isRequired,
3333
base_path: PropTypes.string.isRequired,

src/components/pages/LessonPage.js

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,12 @@ import '../../css/pages/LessonPage.scss';
66
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);
9-
const { title, src, description, order } = lessons[curr_lesson_num];
9+
const lesson = lessons[curr_lesson_num];
1010
const total = lessons.length;
1111

1212
return (
1313
<div className="lesson-page">
14-
<Lesson
15-
order={order}
16-
title={title}
17-
src={src}
18-
description={description}
19-
course_size={total}
20-
base_path={base_path}
21-
/>
14+
<Lesson lesson={lesson} course_size={total} base_path={base_path}/>
2215
<LessonsPane
2316
course_title={course_title}
2417
lessons={lessons}
@@ -37,7 +30,7 @@ LessonPage.propTypes = {
3730
order: PropTypes.number.isRequired,
3831
title: PropTypes.string.isRequired,
3932
src: PropTypes.string.isRequired,
40-
length: PropTypes.number.isRequired,
33+
length: PropTypes.string.isRequired,
4134
description: PropTypes.string.isRequired,
4235
}),
4336
).isRequired,

src/css/lesson/LessonInfo.scss

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,30 @@
1616
color: var(--black);
1717
}
1818

19-
#lesson-description {
19+
.lesson-info p {
2020
font-family: var(--fontfamily-alt);
21+
font-weight: bold;
2122
color: var(--black);
23+
}
24+
25+
#yt-info {
26+
margin: 1rem 0;
27+
}
28+
29+
.subheader {
30+
color: var(--brown);
31+
}
32+
33+
.title {
34+
font-family: var(--fontfamily-roboto);
35+
// font-size: 1.1em;
36+
}
37+
38+
#yt-info a {
39+
text-decoration: none;
40+
color: var(--light-blue);
41+
}
42+
43+
#yt-info a:hover {
44+
text-decoration: underline;
2245
}

0 commit comments

Comments
 (0)