-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from TeaByte/main
sync
- Loading branch information
Showing
8 changed files
with
37 additions
and
47 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ import IconAdjustmentsDown from "https://deno.land/x/[email protected]/tsx/ | |
|
||
import { Course, CourseGroup } from "../utils/types.ts"; | ||
import Collapse from "./Collapse.tsx"; | ||
import CourseCard from "./CourseCard.tsx"; | ||
|
||
export default function Drawer( | ||
{ courses }: { courses: (Course | CourseGroup)[] }, | ||
|
@@ -39,10 +40,8 @@ export default function Drawer( | |
); | ||
} else { | ||
return ( | ||
<li class="" key={course.slug}> | ||
<a title={course.title} href={`/${course.slug}`}> | ||
{course.title} | ||
</a> | ||
<li key={course.slug}> | ||
<CourseCard course={course} /> | ||
</li> | ||
); | ||
} | ||
|
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 |
---|---|---|
|
@@ -7,6 +7,8 @@ import { Head } from "$fresh/runtime.ts"; | |
import Editor from "../islands/Editor.tsx"; | ||
import EditButton from "../components/EditButton.tsx"; | ||
|
||
import IconAppWindow from "https://deno.land/x/[email protected]/tsx/app-window.tsx"; | ||
|
||
export const handler: Handlers<{ course: Course; lable: string | undefined }> = | ||
{ | ||
async GET(_req, ctx) { | ||
|
@@ -99,7 +101,16 @@ export default function CoursePage( | |
</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 class="flex justify-between items-center"> | ||
<EditButton slug={course.slug} /> | ||
<div | ||
class="flex items-center gap-1 md:hidden" | ||
id="open-editor" | ||
> | ||
<IconAppWindow /> | ||
<p>فتح المحرر</p> | ||
</div> | ||
</div> | ||
</div> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,21 +12,12 @@ import IconChevronDown from "https://deno.land/x/[email protected]/tsx/chev | |
export const handler: Handlers<CourseGroup> = { | ||
GET(_req, ctx) { | ||
let foundCourseGroup: CourseGroup | Course | undefined = undefined; | ||
const toFind = isNaN(parseInt(ctx.params.slug)) | ||
? decodeURIComponent(ctx.params.slug) | ||
: parseInt(ctx.params.slug); | ||
const toFind = decodeURIComponent(ctx.params.slug); | ||
|
||
if (typeof toFind === "number") { | ||
foundCourseGroup = cache.courses.find((c) => { | ||
return "courses" in c && c.courses.length > 0 && | ||
c.order === toFind; | ||
}); | ||
} else { | ||
foundCourseGroup = cache.courses.find((c) => { | ||
return "courses" in c && c.courses.length > 0 && | ||
c.label === toFind; | ||
}); | ||
} | ||
foundCourseGroup = cache.courses.find((c) => { | ||
return "courses" in c && c.courses.length > 0 && | ||
c.label === toFind; | ||
}); | ||
|
||
if (!foundCourseGroup) return ctx.renderNotFound(); | ||
return ctx.render(foundCourseGroup as CourseGroup); | ||
|
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 |
---|---|---|
|
@@ -8,6 +8,7 @@ import { cache } from "../utils/course-cache.ts"; | |
import Footer from "../components/Footer.tsx"; | ||
|
||
import IconChevronDown from "https://deno.land/x/[email protected]/tsx/chevron-down.tsx"; | ||
import Collapse from "../components/Collapse.tsx"; | ||
|
||
export const handler: Handlers<{ courses: (Course | CourseGroup)[] }> = { | ||
async GET(_req, ctx) { | ||
|
@@ -44,21 +45,11 @@ export default function BlogIndexPage( | |
// Group of courses | ||
if ("courses" in course) { | ||
return ( | ||
<div class="mt-4" key={index}> | ||
<a | ||
href={`/group/${course.order}`} | ||
class="flex gap-1 items-center" | ||
> | ||
<h2 class="text-3xl font-bold hover:opacity-75"> | ||
{course.label} | ||
</h2> | ||
<IconChevronDown /> | ||
</a> | ||
<div class="flex flex-col mt-2 pr-3"> | ||
{course.courses.map((innerCourse) => ( | ||
<CourseCard key={innerCourse.slug} course={innerCourse} /> | ||
))} | ||
</div> | ||
<div key={index} class="mt-2"> | ||
<Collapse | ||
titile={course.label} | ||
courses={course.courses} | ||
/> | ||
</div> | ||
); | ||
} else { | ||
|
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