refactor: docubook@latest template nextjs-docker

This commit is contained in:
gitfromwildan
2026-05-30 18:52:21 +07:00
parent bf2ef37f49
commit 80eb49d968
101 changed files with 1759 additions and 4165 deletions

33
lib/mdx/Outlet.tsx Normal file
View File

@@ -0,0 +1,33 @@
import Link from "next/link";
import { getAllChilds, type BaseMdxFrontmatter } from "@/lib/markdown";
type OutletProps = {
path: string;
};
type ChildCardProps = BaseMdxFrontmatter & { href: string };
export default async function Outlet({ path }: OutletProps) {
if (!path) {
throw new Error("path not provided");
}
const output = await getAllChilds(path);
return (
<div className="grid md:grid-cols-2 gap-5">
{output.map((child) => (
<ChildCard {...child} key={child.title} />
))}
</div>
);
}
function ChildCard({ description, href, title }: ChildCardProps) {
return (
<Link href={href} className="border rounded-md p-4 no-underline flex flex-col gap-0.5">
<h4 className="!my-0">{title}</h4>
<p className="text-sm text-muted-foreground !my-0">{description}</p>
</Link>
);
}

11
lib/mdx/index.ts Normal file
View File

@@ -0,0 +1,11 @@
import type { MdxComponentMap } from "@docubook/mdx-content";
import Outlet from "@/lib/mdx/Outlet";
// import your custom MDX components here and add them to the `customMdxComponents` object below to make them available in your MDX files. For example:
// import { MyCustomComponent } from "@/lib/mdx/MyCustomComponent";
export const customMdxComponents: MdxComponentMap = {
Outlet,
// MyCustomComponent, --- IGNORE ---
};
// you must also add MyCustomComponent.tsx to lib/mdx/MyCustomComponent.tsx and export it from there, and then export it from this file as well to make it available for import in mdx-components.ts.