refactor(notification): blocking added
This commit is contained in:
26
frontend/src/lib/docs.ts
Normal file
26
frontend/src/lib/docs.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import type { ComponentType } from "react";
|
||||
|
||||
const modules = import.meta.glob("../docs/**/*.tsx", {
|
||||
eager: true,
|
||||
});
|
||||
|
||||
type DocModule = {
|
||||
default: ComponentType;
|
||||
};
|
||||
|
||||
const docsMap: Record<string, ComponentType> = {};
|
||||
|
||||
for (const path in modules) {
|
||||
const mod = modules[path] as DocModule;
|
||||
|
||||
const slug = path
|
||||
.replace("../docs/", "")
|
||||
.replace(".tsx", "");
|
||||
|
||||
// "notifications/intro"
|
||||
docsMap[slug] = mod.default;
|
||||
}
|
||||
|
||||
export function getDoc(slug: string) {
|
||||
return docsMap[slug];
|
||||
}
|
||||
Reference in New Issue
Block a user