From d10f1431fb36fb805e144940be4ad39d71a9330e Mon Sep 17 00:00:00 2001 From: mahdi andalib Date: Tue, 25 Jan 2022 06:51:09 +0330 Subject: [PATCH 1/3] update --- src/App.js | 4 ++-- src/components/CourseChapter/index.js | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/App.js b/src/App.js index 519e23a..3778b76 100644 --- a/src/App.js +++ b/src/App.js @@ -57,14 +57,14 @@ function App() { {/* */} {/* */} {/* */} - + {/* */} {/* */} {/* */} {/* */} {/* */} {/* */} {/* */} - + {/* */} {/* */} {/* */} {/* */} diff --git a/src/components/CourseChapter/index.js b/src/components/CourseChapter/index.js index 97ea0a4..34bdece 100644 --- a/src/components/CourseChapter/index.js +++ b/src/components/CourseChapter/index.js @@ -4,7 +4,7 @@ const CourseChapter = ({ chapters }) => { return (
{/* top */} @@ -54,6 +54,7 @@ const CourseChapter = ({ chapters }) => { ))}
))} +
); From c7d7fde54f764de6695716e804e25f4fbd3282bf Mon Sep 17 00:00:00 2001 From: mahdi andalib Date: Tue, 25 Jan 2022 11:35:02 +0330 Subject: [PATCH 2/3] update --- src/App.js | 2 +- src/components/CourseChapter/index.js | 89 +++++++++++++++++++++------ 2 files changed, 71 insertions(+), 20 deletions(-) diff --git a/src/App.js b/src/App.js index 3778b76..15939d6 100644 --- a/src/App.js +++ b/src/App.js @@ -63,7 +63,7 @@ function App() { {/* */} {/* */} {/* */} - {/* */} + {/* */} {/* */} {/* */} diff --git a/src/components/CourseChapter/index.js b/src/components/CourseChapter/index.js index 34bdece..983d2d4 100644 --- a/src/components/CourseChapter/index.js +++ b/src/components/CourseChapter/index.js @@ -1,6 +1,8 @@ -import React from "react"; +import React, { useState } from "react"; const CourseChapter = ({ chapters }) => { + const [selectedLesson,setSelectedLesson] = useState(null); + return (
{ {/* divider */}
{/* course title */} - {chapters.map((chapter, index) => ( + {chapters.map((chapter, i) => (

{chapter.title}

{chapter.duration}
+ {/* course lessons */} {chapter.lessons.map((lesson, index) => ( -
+ +
{/* right div dot dot */} -
- mahdi +
+
+
{/* left div content */} -
+
setSelectedLesson(lesson)} + > {/* top */} -
-
-

{lesson.title}

- - {lesson.duration} - -
-
- {/* bottom */} -
- - {lesson.play} +
+

+ {lesson.title} +

+ + {lesson.duration}
+ {/* divider */} +
+ {/* bottom */} + + {lesson.play} +
))}
))} + {/* blue left border */}
@@ -68,8 +95,32 @@ CourseChapter.defaultProps = { title: "فصل اول: مباحث جوشش مواد مذاب در مرکز", duration: "2:30:13", lessons: [ - { title: "آیا گوگل از ما دزدی میکند؟", duration: "14:30", play: "پخش" }, + { + title: "آیا گوگل از ما دزدی میکند؟", + duration: "14:30", + play: "پخش", + // step : true, + }, + { + title: "چگونگی ساخت نیروگاه های برقی", + duration: "22:31", + play: "در حال پخش", + // step : false, + }, + { + title: "آیا از اینترنت می توان درآمد داشت؟", + duration: "10:09", + play: "نمایش", + // step : false, + }, + { + title: "زمین سبز و آسمان آبی", + duration: "56:09", + play: "نمایش", + // step : false, + }, ], }, ], + }; From 2609590cd377ed1e77e75d2729261ecfb3ad7bd0 Mon Sep 17 00:00:00 2001 From: mahdi andalib Date: Tue, 25 Jan 2022 12:07:05 +0330 Subject: [PATCH 3/3] course component added --- src/App.js | 10 ++++----- src/components/CourseChapter/index.js | 29 +++++++++++---------------- 2 files changed, 17 insertions(+), 22 deletions(-) diff --git a/src/App.js b/src/App.js index 15939d6..4a94e49 100644 --- a/src/App.js +++ b/src/App.js @@ -63,12 +63,12 @@ function App() { {/* */} {/* */} {/* */} - + {/* */} {/* */} - {/* */} - {/* */} - {/* */} - {/* */} + + + + diff --git a/src/components/CourseChapter/index.js b/src/components/CourseChapter/index.js index 983d2d4..5a73748 100644 --- a/src/components/CourseChapter/index.js +++ b/src/components/CourseChapter/index.js @@ -22,31 +22,26 @@ const CourseChapter = ({ chapters }) => { {/* divider */}
{/* course title */} - {chapters.map((chapter, i) => ( + {chapters.map((chapter, index) => (

{chapter.title}

{chapter.duration}
{/* course lessons */} - {chapter.lessons.map((lesson, index) => ( - + {chapter.lessons.map((lesson, i) => (
{/* right div dot dot */}
+
+
-
{/* left div content */} @@ -99,25 +94,25 @@ CourseChapter.defaultProps = { title: "آیا گوگل از ما دزدی میکند؟", duration: "14:30", play: "پخش", - // step : true, + passed : true, }, { title: "چگونگی ساخت نیروگاه های برقی", duration: "22:31", play: "در حال پخش", - // step : false, + passed : true, }, { title: "آیا از اینترنت می توان درآمد داشت؟", duration: "10:09", play: "نمایش", - // step : false, + passed : false, }, { title: "زمین سبز و آسمان آبی", duration: "56:09", play: "نمایش", - // step : false, + passed : false, }, ], },