Skip to content

Commit

Permalink
feat: create a list of course descriptions that point to a playlist
Browse files Browse the repository at this point in the history
this closes #241
  • Loading branch information
marianzburlea committed Sep 21, 2019
1 parent 324aef3 commit 9aba852
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 2 deletions.
9 changes: 9 additions & 0 deletions src/component/course-play-list/course-play-list.component.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React from 'react'

const CoursePlayList = ({ courseId }) => {
return (
<div>course play list with id: {courseId}</div>
)
}

export default CoursePlayList
Empty file.
1 change: 1 addition & 0 deletions src/component/course-play-list/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './course-play-list.component'
12 changes: 10 additions & 2 deletions src/component/home/home.component.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import React, { useEffect, useState, Fragment } from 'react';
import React, { useEffect, useState } from 'react';
import HeaderTitle from '../_dumb/header-title';
import { db } from '../data/firebase';
import { debounce } from 'lodash'
import { navigate } from '@reach/router'
import { StyledCourse, StyledCourseList, StyledWatchNow } from './home.style';

const Home = () => {
Expand Down Expand Up @@ -36,13 +37,20 @@ const Home = () => {
}
}, []);

const goToCoursePlayList = id => {
console.log(id)
navigate(`/course/${id}`)
}

const renderCourseList = () => {
return data.courseList.map(({ title, id, description, totalDuration, externalThumbnail }) => (
<StyledCourse key={id} externalThumbnail={externalThumbnail}>
<HeaderTitle text={title} tag="h2" fontSize="1.2rem" />
<p>{description}</p>
<div>Watch time: {totalDuration}</div>
<StyledWatchNow>Watch now</StyledWatchNow>
<StyledWatchNow
onClick={() => goToCoursePlayList(id)}
>Watch now</StyledWatchNow>
</StyledCourse>
));
};
Expand Down
2 changes: 2 additions & 0 deletions src/component/web-info/web-info.component.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import PlayVideo from '../play-video';
import ManageUser from '../manage-user';
import Subscribe from '../subscribe';
import HomeOld from '../home-old';
import CoursePlayList from '../course-play-list';

const WebInfo = () => {
return (
Expand All @@ -20,6 +21,7 @@ const WebInfo = () => {
<Course path="/manage/course/:courseId" />
<Lecture path="/manage/lecture/:lectureId" />
<PlayVideo path="/video/:youtubeVideoId" />
<CoursePlayList path="/course/:courseId" />
<ManageUser path="/manage/user" />
<Subscribe path="/subscribe" />
</StyledRouter>
Expand Down

0 comments on commit 9aba852

Please sign in to comment.