|
|
|
@ -4,23 +4,23 @@ const CourseChapter = ({ courseTitle, lessonName, grade, chapters }) => { |
|
|
|
|
const [selectedLesson, setSelectedLesson] = useState(null); |
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
|
<div className="max-h-[444px] relative p-4 bg-[#196EC033] rounded overflow-y-auto scrollYDesign"> |
|
|
|
|
<div className="max-h-[444px] relative p-4 bg-surface border border-surfaceBorder rounded overflow-y-auto scrollYDesign"> |
|
|
|
|
{/* top */} |
|
|
|
|
<div className="flex flex-row items-center justify-between"> |
|
|
|
|
<h2 className="text-blue-800 text-base">{courseTitle}</h2> |
|
|
|
|
<h2 className="text-primaryText text-base">{courseTitle}</h2> |
|
|
|
|
<div className="flex flex-row-reverse items-center divide-x"> |
|
|
|
|
<span className="text-blue-800 text-sm px-2">{lessonName}</span> |
|
|
|
|
<span className="text-blue-800 text-sm px-2">{grade}</span> |
|
|
|
|
<span className="text-primaryText text-sm px-2">{lessonName}</span> |
|
|
|
|
<span className="text-primaryText text-sm px-2">{grade}</span> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
{/* divider */} |
|
|
|
|
<div className="border-b border-blue-300 my-5"></div> |
|
|
|
|
<div className="border-b border-surfaceBorder my-5"></div> |
|
|
|
|
{/* course title */} |
|
|
|
|
{chapters.map((chapter, index) => ( |
|
|
|
|
<div className="flex flex-col mt-4" key={index}> |
|
|
|
|
<div className="bg-blue-600 rounded-sm p-4 flex flex-row items-center justify-between"> |
|
|
|
|
<p className="text-sm text-white">{chapter.title}</p> |
|
|
|
|
<span className="text-sm text-white">{chapter.duration}</span> |
|
|
|
|
<div className="bg-primary rounded p-4 flex flex-row items-center justify-between"> |
|
|
|
|
<p className="text-sm text-primaryText">{chapter.title}</p> |
|
|
|
|
<span className="text-sm text-primaryText">{chapter.duration}</span> |
|
|
|
|
</div> |
|
|
|
|
{/* course lessons */} |
|
|
|
|
{chapter.lessons.map((lesson, i) => ( |
|
|
|
@ -35,22 +35,22 @@ const CourseChapter = ({ courseTitle, lessonName, grade, chapters }) => { |
|
|
|
|
> |
|
|
|
|
<div |
|
|
|
|
className={`w-4 h-4 flex justify-center items-center rounded-full
|
|
|
|
|
${selectedLesson === lesson ? "bg-red-600" : "bg-blue-600"}, |
|
|
|
|
${lesson.passed ? "bg-red-600" : "bg-blue-600"} |
|
|
|
|
${selectedLesson === lesson ? "bg-error" : "bg-success"}, |
|
|
|
|
${lesson.passed ? "bg-error" : "bg-success"} |
|
|
|
|
`}
|
|
|
|
|
></div> |
|
|
|
|
{Number(i) !== chapter.lessons.length - 1 && ( |
|
|
|
|
<span |
|
|
|
|
className={`h-[65px] border-r-2 border-dotted ${ |
|
|
|
|
lesson.passed ? "border-green-400" : "border-purple-400" |
|
|
|
|
lesson.passed ? "border-success" : "border-error" |
|
|
|
|
}`}
|
|
|
|
|
></span> |
|
|
|
|
)} |
|
|
|
|
</div> |
|
|
|
|
{/* left div content */} |
|
|
|
|
<div |
|
|
|
|
className={`group flex-1 flex flex-col mt-2 bg-white hover:bg-blue-600 border border-blue-600 rounded-md cursor-pointer transition duration-200 ease-in-out
|
|
|
|
|
${selectedLesson === lesson ? "bg-blue-600" : ""}`}
|
|
|
|
|
className={`group flex-1 flex flex-col mt-2 bg-white hover:bg-primary border border-primary rounded cursor-pointer transition duration-200 ease-in-out
|
|
|
|
|
${selectedLesson === lesson ? "bg-primary" : ""}`}
|
|
|
|
|
// onClick={() => setSelectedLesson(lesson)}
|
|
|
|
|
onClick={() => |
|
|
|
|
setSelectedLesson(selectedLesson === lesson ? null : lesson) |
|
|
|
@ -60,13 +60,13 @@ const CourseChapter = ({ courseTitle, lessonName, grade, chapters }) => { |
|
|
|
|
<div className="flex flex-row items-center justify-between p-2"> |
|
|
|
|
<p |
|
|
|
|
className={`text-sm text-blue-500 group-hover:text-white
|
|
|
|
|
${selectedLesson === lesson ? "text-red-600" : ""}`}
|
|
|
|
|
${selectedLesson === lesson ? "primaryText" : ""}`}
|
|
|
|
|
> |
|
|
|
|
{lesson.title} |
|
|
|
|
</p> |
|
|
|
|
<span |
|
|
|
|
className={`text-xs text-blue-500 group-hover:text-white border-r border-blue-200 pr-1
|
|
|
|
|
${selectedLesson === lesson ? "text-red-600" : ""}`}
|
|
|
|
|
${selectedLesson === lesson ? "primaryText" : ""}`}
|
|
|
|
|
> |
|
|
|
|
{lesson.duration} |
|
|
|
|
</span> |
|
|
|
@ -74,13 +74,13 @@ const CourseChapter = ({ courseTitle, lessonName, grade, chapters }) => { |
|
|
|
|
{/* divider */} |
|
|
|
|
<div |
|
|
|
|
className={`border-t border-blue-600 group-hover:border-white ${ |
|
|
|
|
selectedLesson === lesson ? "border-red-600" : "" |
|
|
|
|
selectedLesson === lesson ? "primaryText" : "" |
|
|
|
|
}`}
|
|
|
|
|
></div> |
|
|
|
|
{/* bottom */} |
|
|
|
|
<span |
|
|
|
|
className={`text-xs text-center text-blue-500 group-hover:text-white p-2
|
|
|
|
|
${selectedLesson === lesson ? "text-red-600" : ""}`}
|
|
|
|
|
${selectedLesson === lesson ? "primaryText" : ""}`}
|
|
|
|
|
> |
|
|
|
|
{lesson.play} |
|
|
|
|
</span> |
|
|
|
|