-
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
10 changed files
with
109 additions
and
153 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { Course } from "../utils/types.ts"; | ||
|
||
export default function CourseCard(props: { course: Course }) { | ||
const { course } = props; | ||
return ( | ||
<div | ||
class="py-4 gray-200 hover:opacity-75" | ||
style={{ order: course.order }} | ||
> | ||
<a href={btoa(`/${course.slug}`)}> | ||
<h3 class="gray-900 font-bold"> | ||
{course.title} | ||
</h3> | ||
<div class="text-gray-500 truncate text-ellipsis max-w-[300px] md:max-w-full overflow-hidden"> | ||
{course.snippet} | ||
</div> | ||
</a> | ||
</div> | ||
); | ||
} |
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 |
---|---|---|
@@ -1,9 +1,23 @@ | ||
function isMobile() { | ||
return window.innerWidth <= 768; | ||
} | ||
|
||
document.addEventListener("DOMContentLoaded", function () { | ||
document.body.style.overflow = "hidden"; | ||
|
||
Split(["#split-0", "#split-1"], { | ||
gutterAlign: "start", | ||
minSize: 0, | ||
gutterSize: 13, | ||
}); | ||
if (isMobile()) { | ||
Split(["#split-0", "#split-1"], { | ||
sizes: [0, 100], | ||
gutterAlign: "start", | ||
minSize: 0, | ||
gutterSize: 13, | ||
}); | ||
} else { | ||
Split(["#split-0", "#split-1"], { | ||
sizes: [50, 50], | ||
gutterAlign: "start", | ||
minSize: 0, | ||
gutterSize: 13, | ||
}); | ||
} | ||
}); |
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,13 +1,36 @@ | ||
export interface Course { | ||
slug: string; | ||
title: string; | ||
content: string; | ||
snippet: string; | ||
order: number; | ||
import { join } from "$std/path/mod.ts"; | ||
import { readJson } from "https://deno.land/std@0.66.0/fs/read_json.ts"; | ||
import { extract } from "https://deno.land/std@0.151.0/encoding/front_matter.ts"; | ||
|
||
import { Course, CourseAttributes } from "../utils/types.ts"; | ||
|
||
export async function getGroupOrder( | ||
groupPath: string, | ||
): Promise<{ order: number; label: string } | undefined> { | ||
try { | ||
const dataJsonPath = join(groupPath, "_data.json"); | ||
const jsonData = await readJson(dataJsonPath) as { | ||
order: number; | ||
label: string; | ||
}; | ||
return { ...jsonData }; | ||
} catch { | ||
return undefined; | ||
} | ||
} | ||
|
||
export interface CourseGroup { | ||
courses: Course[]; | ||
order?: number; | ||
label?: string; | ||
export async function getCourse( | ||
slug: string, | ||
): Promise<Course | null> { | ||
const text = await Deno.readTextFile(join("./courses", `${slug}.md`)); | ||
const { attrs, body } = extract(text); | ||
const courseAttrs = attrs as CourseAttributes; | ||
const course: Course = { | ||
slug, | ||
title: courseAttrs.title || "بدون عنوان", | ||
content: body || "لايوجد محتوى", | ||
snippet: courseAttrs.snippet || "لا يوجد", | ||
order: courseAttrs.order || 999, | ||
}; | ||
return course; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
export interface Course { | ||
slug: string; | ||
title: string; | ||
content: string; | ||
snippet: string; | ||
order: number; | ||
} | ||
|
||
export interface CourseGroup { | ||
courses: Course[]; | ||
order?: number; | ||
label?: string; | ||
} | ||
|
||
export interface CourseAttributes { | ||
title?: string; | ||
snippet?: string; | ||
order?: number; | ||
} |