-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
73 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import { render } from "https://deno.land/x/gfm/mod.ts"; | ||
import { Course } from "../utils/types.ts"; | ||
import IconPlayerTrackNext from "https://deno.land/x/[email protected]/tsx/player-track-next.tsx" | ||
import IconPlayerTrackPrev from "https://deno.land/x/[email protected]/tsx/player-track-prev.tsx" | ||
import IconPlayerTrackNext from "https://deno.land/x/[email protected]/tsx/player-track-next.tsx"; | ||
import IconPlayerTrackPrev from "https://deno.land/x/[email protected]/tsx/player-track-prev.tsx"; | ||
import EditButton from "../components/EditButton.tsx"; | ||
|
||
export default function MarkdownSplit({ | ||
|
@@ -18,63 +18,65 @@ export default function MarkdownSplit({ | |
prevCourse: string | undefined; | ||
}) { | ||
return ( | ||
<section dir="rtl" class="p-3 py-5 mb-40"> | ||
<div> | ||
<div className="flex flex-col-reverse"> | ||
<div class="flex flex-col-reverse text-sm breadcrumbs" dir="rtl"> | ||
<ul> | ||
<li> | ||
<a href="/">الرئيسية</a> | ||
</li> | ||
{lable && ( | ||
<li> | ||
<a href={`/group/${lableSlug}`}>{lable}</a> | ||
</li> | ||
)} | ||
<li class="underline">{course.title}</li> | ||
</ul> | ||
</div> | ||
</div> | ||
<div class="flex flex-col gap-2 md:flex-row justify-between mb-4"> | ||
<h1 class="text-3xl">{course.title}</h1> | ||
<EditButton slug={course.slug} /> | ||
</div> | ||
</div> | ||
|
||
<div | ||
id="document" | ||
class="markdown-body" | ||
style={{ backgroundColor: "inherit" }} | ||
dangerouslySetInnerHTML={{ | ||
__html: render(course.content, { | ||
disableHtmlSanitization: true, | ||
}), | ||
}} | ||
/> | ||
<div class="flex justify-between mt-4"> | ||
<div> | ||
<> | ||
<div class="flex px-2 pt-2 gap-2"> | ||
<div class="grow overflow-hidden"> | ||
{prevCourse && ( | ||
<a | ||
href={`/${prevCourse}`} | ||
class="flex flex-row items-center gap-2 btn btn-outline" | ||
class="flex items-center gap-2 btn btn-outline flex-nowrap" | ||
> | ||
<IconPlayerTrackNext size={18} /> | ||
<span>الدرس السابق</span> | ||
</a> | ||
)} | ||
</div> | ||
<div> | ||
<div class="grow overflow-hidden"> | ||
{nextCourse && ( | ||
<a | ||
href={`/${nextCourse}`} | ||
class="flex flex-row items-center gap-2 btn btn-outline" | ||
href={`/${nextCourse}`} | ||
class="flex items-center gap-2 btn btn-outline flex-nowrap" | ||
> | ||
<span>الدرس التالي</span> | ||
<IconPlayerTrackPrev size={18} /> | ||
<IconPlayerTrackPrev size={18} /> | ||
</a> | ||
)} | ||
</div> | ||
</div> | ||
</section> | ||
<section dir="rtl" class="p-3 py-5 mb-24 md:mb-0"> | ||
<div> | ||
<div className="flex flex-col-reverse"> | ||
<div class="flex flex-col-reverse text-sm breadcrumbs" dir="rtl"> | ||
<ul> | ||
<li> | ||
<a href="/">الرئيسية</a> | ||
</li> | ||
{lable && ( | ||
<li> | ||
<a href={`/group/${lableSlug}`}>{lable}</a> | ||
</li> | ||
)} | ||
<li class="underline">{course.title}</li> | ||
</ul> | ||
</div> | ||
</div> | ||
<div class="flex flex-col gap-2 md:flex-row justify-between mb-4"> | ||
<h1 class="text-3xl">{course.title}</h1> | ||
<EditButton slug={course.slug} /> | ||
</div> | ||
</div> | ||
|
||
<div | ||
id="document" | ||
class="markdown-body" | ||
style={{ backgroundColor: "inherit" }} | ||
dangerouslySetInnerHTML={{ | ||
__html: render(course.content, { | ||
disableHtmlSanitization: true, | ||
}), | ||
}} | ||
/> | ||
</section> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,7 @@ import IconAppWindow from "https://deno.land/x/[email protected]/tsx/app-wi | |
import { findNextCourse } from "../utils/course.ts"; | ||
import { findPrevCourse } from "../utils/course.ts"; | ||
|
||
interface Props { | ||
interface Props { | ||
course: Course; | ||
lable: string | undefined; | ||
lableSlug: string | undefined; | ||
|
@@ -33,7 +33,13 @@ export const handler: Handlers<Props> = { | |
const [lableSlug, lable] = await getJson(ctx.params.slug.split("/")[0]); | ||
return ctx.render({ course, lable, lableSlug, nextCourse, prevCourse }); | ||
} | ||
return ctx.render({ course, lable: undefined, lableSlug: undefined, nextCourse, prevCourse }); | ||
return ctx.render({ | ||
course, | ||
lable: undefined, | ||
lableSlug: undefined, | ||
nextCourse, | ||
prevCourse, | ||
}); | ||
} catch { | ||
return ctx.renderNotFound(); | ||
} | ||
|