|
|
@ -1,39 +1,21 @@ |
|
|
|
import { Check } from 'lucide-react'; |
|
|
|
import { Check } from 'lucide-react'; |
|
|
|
import { cn } from '../../lib/classname'; |
|
|
|
import { cn } from '../../lib/classname'; |
|
|
|
|
|
|
|
import type { |
|
|
|
|
|
|
|
ChallengeFileType, |
|
|
|
|
|
|
|
ChapterFileType, |
|
|
|
|
|
|
|
LessonFileType, |
|
|
|
|
|
|
|
QuizFileType, |
|
|
|
|
|
|
|
} from '../../lib/course'; |
|
|
|
|
|
|
|
|
|
|
|
export type Lesson = { |
|
|
|
type ChapterProps = ChapterFileType & { |
|
|
|
slug: string; |
|
|
|
|
|
|
|
index: number; |
|
|
|
index: number; |
|
|
|
title: string; |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export type Quiz = { |
|
|
|
|
|
|
|
slug: string; |
|
|
|
|
|
|
|
index: number; |
|
|
|
|
|
|
|
title: string; |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export type Challenge = { |
|
|
|
|
|
|
|
slug: string; |
|
|
|
|
|
|
|
index: number; |
|
|
|
|
|
|
|
title: string; |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export type Chapter = { |
|
|
|
|
|
|
|
index: number; |
|
|
|
|
|
|
|
slug: string; |
|
|
|
|
|
|
|
title: string; |
|
|
|
|
|
|
|
lessons: Lesson[]; |
|
|
|
|
|
|
|
exercises: (Quiz | Challenge)[]; |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
type ChapterProps = Chapter & { |
|
|
|
|
|
|
|
isActive?: boolean; |
|
|
|
isActive?: boolean; |
|
|
|
isCompleted?: boolean; |
|
|
|
isCompleted?: boolean; |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
export function Chapter(props: ChapterProps) { |
|
|
|
export function Chapter(props: ChapterProps) { |
|
|
|
const { index, title, lessons, exercises, isActive = false } = props; |
|
|
|
const { index, frontmatter, lessons, exercises, isActive = false } = props; |
|
|
|
|
|
|
|
const { title } = frontmatter; |
|
|
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<div> |
|
|
|
<div> |
|
|
@ -53,7 +35,7 @@ export function Chapter(props: ChapterProps) { |
|
|
|
<div className="flex flex-col border-b border-zinc-800"> |
|
|
|
<div className="flex flex-col border-b border-zinc-800"> |
|
|
|
<div> |
|
|
|
<div> |
|
|
|
{lessons.map((lesson) => ( |
|
|
|
{lessons.map((lesson) => ( |
|
|
|
<Lesson key={lesson.slug} {...lesson} isCompleted={false} /> |
|
|
|
<Lesson key={lesson.id} {...lesson} isCompleted={false} /> |
|
|
|
))} |
|
|
|
))} |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
@ -67,7 +49,7 @@ export function Chapter(props: ChapterProps) { |
|
|
|
|
|
|
|
|
|
|
|
<div> |
|
|
|
<div> |
|
|
|
{exercises.map((exercise) => ( |
|
|
|
{exercises.map((exercise) => ( |
|
|
|
<Lesson key={exercise.slug} {...exercise} isCompleted={false} /> |
|
|
|
<Lesson key={exercise.id} {...exercise} isCompleted={false} /> |
|
|
|
))} |
|
|
|
))} |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
@ -76,13 +58,14 @@ export function Chapter(props: ChapterProps) { |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
type LessonProps = (Lesson | Quiz | Challenge) & { |
|
|
|
type LessonProps = (LessonFileType | QuizFileType | ChallengeFileType) & { |
|
|
|
isActive?: boolean; |
|
|
|
isActive?: boolean; |
|
|
|
isCompleted?: boolean; |
|
|
|
isCompleted?: boolean; |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
export function Lesson(props: LessonProps) { |
|
|
|
export function Lesson(props: LessonProps) { |
|
|
|
const { title, isCompleted, isActive } = props; |
|
|
|
const { frontmatter, isCompleted, isActive } = props; |
|
|
|
|
|
|
|
const { title } = frontmatter; |
|
|
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<a |
|
|
|
<a |
|
|
|