diff --git a/content/books/sample-book.mdx b/content/books/sample-book.mdx new file mode 100644 index 0000000..b0a0fd6 --- /dev/null +++ b/content/books/sample-book.mdx @@ -0,0 +1,10 @@ +--- +title: "Clean Code" +authorName: "Robert C. Martin" +link: "https://www.oreilly.com/library/view/clean-code-a/9780136083238/" +image: "https://m.media-amazon.com/images/I/41xShlnTZTL._SX374_BO1,204,203,200_.jpg" +authorEmail: "unclebob@example.com" +authorLink: "https://blog.cleancoder.com/" +--- + +Recommended software craftsmanship reading. diff --git a/contentlayer.config.ts b/contentlayer.config.ts index a95c9fe..712ac32 100644 --- a/contentlayer.config.ts +++ b/contentlayer.config.ts @@ -53,9 +53,26 @@ export const Profile = defineDocumentType(() => ({ computedFields: computedFields, })); +const bookFields: FieldDefs = { + title: { type: "string", required: true }, + authorName: { type: "string", required: true }, + link: { type: "string", required: true }, + image: { type: "string", required: false }, + authorEmail: { type: "string", required: false }, + authorLink: { type: "string", required: false }, +}; + +export const Book = defineDocumentType(() => ({ + name: "Book", + filePathPattern: `./books/**/*.mdx`, + fields: bookFields, + contentType: "mdx", + computedFields: computedFields, +})); + export default makeSource({ contentDirPath: "./content", - documentTypes: [Blog, Profile], + documentTypes: [Blog, Profile, Book], mdx: { remarkPlugins: [remarkGfm], rehypePlugins: [ diff --git a/messages/en.json b/messages/en.json index f0632a4..0f80aa0 100644 --- a/messages/en.json +++ b/messages/en.json @@ -59,6 +59,7 @@ "nav": { "home": "Home", "profiles": "Profiles", + "books": "Books", "editor": "Editor", "howTo": "How to", "blog": "Blog", @@ -368,6 +369,7 @@ "navigate": "Navigate", "home": "Home", "profiles": "Profiles", + "books": "Books", "profileEditor": "Profile Editor", "blog": "Blog", "contactUs": "Contact Us", diff --git a/messages/mm.json b/messages/mm.json index f466a7e..70bbbff 100644 --- a/messages/mm.json +++ b/messages/mm.json @@ -59,6 +59,7 @@ "nav": { "home": "ပင်မစာမျက်နှာ", "profiles": "ပရိုဖိုင်များ", + "books": "စာအုပ်များ", "editor": "အယ်ဒီတာ", "howTo": "လမ်းညွှန်", "blog": "ဘလော့ဂ်", @@ -368,6 +369,7 @@ "navigate": "လမ်းညွှန်", "home": "ပင်မစာမျက်နှာ", "profiles": "ပရိုဖိုင်များ", + "books": "စာအုပ်များ", "profileEditor": "ပရိုဖိုင် အယ်ဒီတာ", "blog": "ဘလော့ဂ်", "contactUs": "ဆက်သွယ်ရန်", diff --git a/src/app/books/page.tsx b/src/app/books/page.tsx new file mode 100644 index 0000000..1773caf --- /dev/null +++ b/src/app/books/page.tsx @@ -0,0 +1,120 @@ +import PageTransitionWrapper from "@/components/Animate/PageTransitionWrapper/PageTransitionWrapper"; +import Container from "@/components/Common/Container/Container"; +import SpacingDivider from "@/components/Common/SpacingDivider/SpacingDivider"; +import APP_CONFIG from "@/config/config"; +import { allBooks } from "contentlayer/generated"; +import { Metadata } from "next"; + +export const metadata: Metadata = { + title: `Books | ${APP_CONFIG.title}`, + description: + "Discover recommended tech books and learning resources shared by the MMSWE community.", + openGraph: { + title: `Books | ${APP_CONFIG.title}`, + description: + "Discover recommended tech books and learning resources shared by the MMSWE community.", + images: "https://mmswe.com/images/mmswe-seo.png", + }, +}; + +const BooksPage = async () => { + const books = [...allBooks].sort((a, b) => a.title.localeCompare(b.title)); + + return ( + + +
+
+

+ Community Library +

+

+ Books +

+

+ Recommended tech books and learning resources shared by Myanmar + software engineers. +

+
+ + {books.length === 0 ? ( +
+

+ No books yet +

+

+ Community recommendations will appear here once contributors add + book entries to the repository. +

+
+ ) : ( +
+ {books.map((book) => ( + + ))} +
+ )} +
+ + +
+
+ ); +}; + +export default BooksPage; diff --git a/src/components/Common/Footer/Footer.tsx b/src/components/Common/Footer/Footer.tsx index c002350..dc1ac97 100644 --- a/src/components/Common/Footer/Footer.tsx +++ b/src/components/Common/Footer/Footer.tsx @@ -339,27 +339,36 @@ const Footer = () => { {t("profiles")} - {t("profileEditor")} + {t("books")} + {t("profileEditor")} + + {t("blog")} @@ -368,8 +377,8 @@ const Footer = () => { @@ -378,7 +387,7 @@ const Footer = () => { diff --git a/src/components/Common/Navbar/Navbar.tsx b/src/components/Common/Navbar/Navbar.tsx index 23e4691..72a3c60 100644 --- a/src/components/Common/Navbar/Navbar.tsx +++ b/src/components/Common/Navbar/Navbar.tsx @@ -17,6 +17,7 @@ import SignInButton from "@/components/Auth/SignInButton"; const linkKeys = [ { key: "home", href: "/" }, { key: "profiles", href: "/profile" }, + { key: "books", href: "/books" }, { key: "editor", href: "/profile/editor" }, { key: "howTo", href: "/how-to" }, { key: "blog", href: "/blog" }, @@ -26,6 +27,7 @@ const linkKeys = [ const desktopNavWidthByKey: Record<(typeof linkKeys)[number]["key"], string> = { home: "w-[7rem]", profiles: "w-[6rem]", + books: "w-[5.5rem]", editor: "w-[5.5rem]", howTo: "w-[5.25rem]", blog: "w-[4.5rem]",