Skip to content

Commit

Permalink
add the syllabus
Browse files Browse the repository at this point in the history
  • Loading branch information
Lumi-works committed Aug 2, 2024
1 parent 3eaeecf commit 2da0c36
Show file tree
Hide file tree
Showing 8 changed files with 649 additions and 66 deletions.
153 changes: 153 additions & 0 deletions .contentlayer/generated/Doc/syllabus.mdx.json

Large diffs are not rendered by default.

19 changes: 19 additions & 0 deletions lib/getPostMetadata.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import fs from "fs";
import matter from "gray-matter";

export default function getPostMetadata(basePath) {
const folder = basePath + "/";
const files = fs.readdirSync(folder);
const markdownPosts = files.filter((file) => file.endsWith(".md"));

// get the file data
const posts = markdownPosts.map((filename) => {
const fileContents = fs.readFileSync(`${basePath}/${filename}`, "utf8");
const matterResult = matter(fileContents);
return {
title: matterResult.data.title,
slug: filename.replace(".md", ""),
};
});
return posts;
}
13 changes: 13 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
"contentlayer": "^0.3.4",
"date-fns": "^3.6.0",
"github-slugger": "^2.0.0",
"gray-matter": "^4.0.3",
"markdown-to-jsx": "^7.4.7",
"next": "13.5.4",
"next-contentlayer": "^0.3.4",
"react": "^18",
Expand Down
3 changes: 1 addition & 2 deletions src/app/course-book/[chapter]/[section]/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import { useParams } from "next/navigation";

import { allDocs } from "@/.contentlayer/generated";
import DocDetails from "@/src/components/Doc/DocDetails";
import RenderMdx from "@/src/components/Doc/RenderMdx";
// import DocDetails from "@/src/components/Doc/DocDetails";

const DocPage = () => {
const params = useParams();
Expand All @@ -29,7 +29,6 @@ const DocPage = () => {
</div>
<div className="absolute top-0 left-0 right-0 bottom-0 h-full bg-dark/60 dark:bg-dark/40" />
</div>
{/* <DocDetails doc={doc} slug={slug} /> */}

<div className="grid grid-cols-12 gap-y-8 lg:gap-8 sxl:gap-16 mt-8 px-5 md:px-10">
<div className="col-span-12 lg:col-span-4">
Expand Down
4 changes: 4 additions & 0 deletions src/app/syllabus/page.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.active {
font-weight: bold;
color: #ff0000; /* Example color */
}
Loading

0 comments on commit 2da0c36

Please sign in to comment.