bring over most of the things

This commit is contained in:
MapleLeaf
2022-01-02 16:35:03 -06:00
committed by Darius
parent aa27623d11
commit 336e680b6e
23 changed files with 738 additions and 76 deletions

View File

@@ -1,43 +1,35 @@
import { description } from "reacord/package.json"
import { lazy, Suspense } from "react"
import { Meta, Title } from "react-head"
import { Link, Route, Routes } from "react-router-dom"
import { lazyNamed } from "./helpers/lazy-named"
import { Route, Routes } from "react-router-dom"
import { GuidePageLayout } from "./components/guide-page-layout"
import { LandingPage } from "./pages/landing-page"
export function App() {
return (
<>
<Title>Reacord</Title>
<Meta name="description" content={description} />
<nav>
<Link to="/">Home</Link>{" "}
<Link to="docs/getting-started">Getting Started</Link>{" "}
<Link to="docs/api">API Reference</Link>
</nav>
<Suspense fallback={<></>}>
<Routes>
<Route path="/" element={<LandingPage />} />
<Route path="docs" element={<DocumentPageLayout />}>
{docs.map(({ route, component: Component }) => (
<Route key={route} path={route} element={<Component />} />
))}
</Route>
</Routes>
</Suspense>
<Routes>
<Route path="/" element={<LandingPage />} />
<Route path="docs" element={<GuidePageLayout />}>
{docs.map(({ route, component: Component }) => (
<Route
key={route}
path={route}
element={
<Suspense fallback={<></>}>
<Component />
</Suspense>
}
/>
))}
</Route>
</Routes>
</>
)
}
const LandingPage = lazyNamed(
"LandingPage",
() => import("./pages/landing-page"),
)
const DocumentPageLayout = lazyNamed(
"DocumentPage",
() => import("./pages/document-page"),
)
const docs = Object.entries(import.meta.glob("./docs/*.md")).map(
([path, loadModule]) => ({
route: path.replace("./docs/", "").replace(/\.md$/, ""),