use new docs
This commit is contained in:
34
packages/docs/src/data/guide-links.preval.tsx
Normal file
34
packages/docs/src/data/guide-links.preval.tsx
Normal file
@@ -0,0 +1,34 @@
|
||||
import glob from "fast-glob"
|
||||
import grayMatter from "gray-matter"
|
||||
import { readFile } from "node:fs/promises"
|
||||
import { join } from "node:path"
|
||||
import type { AppLinkProps } from "../components/app-link"
|
||||
|
||||
const docsFolderPath = new URL("../docs", import.meta.url).pathname
|
||||
const guideFiles = await glob("**/*.md", { cwd: docsFolderPath })
|
||||
|
||||
const entries = await Promise.all(
|
||||
guideFiles.map(async (file) => {
|
||||
const content = await readFile(join(docsFolderPath, file), "utf-8")
|
||||
const { data } = grayMatter(content)
|
||||
|
||||
let order = Number(data.order)
|
||||
if (!Number.isFinite(order)) {
|
||||
order = Number.POSITIVE_INFINITY
|
||||
}
|
||||
|
||||
return {
|
||||
route: `/docs/${file.replace(/\.mdx?$/, "")}`,
|
||||
title: String(data.title || ""),
|
||||
order,
|
||||
}
|
||||
}),
|
||||
)
|
||||
|
||||
export const guideLinks: AppLinkProps[] = entries
|
||||
.sort((a, b) => a.order - b.order)
|
||||
.map((item) => ({
|
||||
type: "internal",
|
||||
label: item.title,
|
||||
to: item.route,
|
||||
}))
|
||||
37
packages/docs/src/data/main-links.tsx
Normal file
37
packages/docs/src/data/main-links.tsx
Normal file
@@ -0,0 +1,37 @@
|
||||
import {
|
||||
CodeIcon,
|
||||
DocumentTextIcon,
|
||||
ExternalLinkIcon,
|
||||
} from "@heroicons/react/solid"
|
||||
import type { AppLinkProps } from "../components/app-link"
|
||||
import { inlineIconClass } from "../styles/components"
|
||||
|
||||
export const mainLinks: AppLinkProps[] = [
|
||||
{
|
||||
type: "internal",
|
||||
to: "/docs/getting-started",
|
||||
label: (
|
||||
<>
|
||||
<DocumentTextIcon className={inlineIconClass} /> Guides
|
||||
</>
|
||||
),
|
||||
},
|
||||
{
|
||||
type: "internal",
|
||||
to: "/docs/api",
|
||||
label: (
|
||||
<>
|
||||
<CodeIcon className={inlineIconClass} /> API Reference
|
||||
</>
|
||||
),
|
||||
},
|
||||
{
|
||||
type: "external",
|
||||
to: "https://github.com/itsMapleLeaf/reacord",
|
||||
label: (
|
||||
<>
|
||||
<ExternalLinkIcon className={inlineIconClass} /> GitHub
|
||||
</>
|
||||
),
|
||||
},
|
||||
]
|
||||
Reference in New Issue
Block a user