Initial commit for fumadocs

This commit is contained in:
Morgan Dean
2025-06-10 18:13:28 -04:00
parent 5ce6b2636e
commit 56527f7752
29 changed files with 6665 additions and 0 deletions
+52
View File
@@ -0,0 +1,52 @@
import { source } from '@/lib/source';
import {
DocsPage,
DocsBody,
DocsDescription,
DocsTitle,
} from 'fumadocs-ui/page';
import { notFound } from 'next/navigation';
import { createRelativeLink } from 'fumadocs-ui/mdx';
import { getMDXComponents } from '@/mdx-components';
export default async function Page(props: {
params: Promise<{ slug?: string[] }>;
}) {
const params = await props.params;
const page = source.getPage(params.slug);
if (!page) notFound();
const MDXContent = page.data.body;
return (
<DocsPage toc={page.data.toc} full={page.data.full}>
<DocsTitle>{page.data.title}</DocsTitle>
<DocsDescription>{page.data.description}</DocsDescription>
<DocsBody>
<MDXContent
components={getMDXComponents({
// this allows you to link to other pages with relative file paths
a: createRelativeLink(source, page),
})}
/>
</DocsBody>
</DocsPage>
);
}
export async function generateStaticParams() {
return source.generateParams();
}
export async function generateMetadata(props: {
params: Promise<{ slug?: string[] }>;
}) {
const params = await props.params;
const page = source.getPage(params.slug);
if (!page) notFound();
return {
title: page.data.title,
description: page.data.description,
};
}
+38
View File
@@ -0,0 +1,38 @@
import { DocsLayout } from 'fumadocs-ui/layouts/docs';
import type { ReactNode } from 'react';
import { baseOptions } from '@/app/layout.config';
import { source } from '@/lib/source';
import { Home, Library, Cloud } from 'lucide-react';
export default function Layout({ children }: { children: ReactNode }) {
return (
<DocsLayout
tree={source.pageTree}
sidebar={{
tabs: [
{
url: '/home',
title: 'Home',
description: 'Welcome to Cua Documentation',
icon: <Home />,
},
{
url: '/libraries',
title: 'Libraries',
description: 'Library Documentation',
icon: <Library />,
},
{
url: '/cloud',
title: 'Cloud',
description: 'Cua Cloud Documentation',
icon: <Cloud />,
},
],
}}
{...baseOptions}
>
{children}
</DocsLayout>
);
}
+4
View File
@@ -0,0 +1,4 @@
import { source } from '@/lib/source';
import { createFromSource } from 'fumadocs-core/search/server';
export const { GET } = createFromSource(source);
+3
View File
@@ -0,0 +1,3 @@
@import 'tailwindcss';
@import 'fumadocs-ui/css/neutral.css';
@import 'fumadocs-ui/css/preset.css';
+53
View File
@@ -0,0 +1,53 @@
import type { BaseLayoutProps } from 'fumadocs-ui/layouts/shared';
import Image from 'next/image';
import logoBlack from '@/assets/logo-black.svg';
import logoWhite from '@/assets/logo-white.svg';
import { HomeIcon } from 'lucide-react';
/**
* Shared layout configurations
*
* you can customise layouts individually from:
* Home Layout: app/(home)/layout.tsx
* Docs Layout: app/docs/layout.tsx
*/
export const baseOptions: BaseLayoutProps = {
nav: {
title: (
<>
<Image
width={30}
height={30}
src={logoBlack}
aria-label="Logo"
className="block dark:hidden"
alt="Logo"
/>
<Image
width={30}
height={30}
src={logoWhite}
aria-label="Logo"
className="hidden dark:block"
alt="Logo"
/>
Cua Documentation
</>
),
},
githubUrl: 'https://github.com/trycua/cua',
links: [
{
url: '/home',
text: 'Documentation Home',
icon: <HomeIcon />,
},
{
url: 'https://trycua.com',
text: 'cua home',
type: 'icon',
icon: <HomeIcon />,
},
],
};
+18
View File
@@ -0,0 +1,18 @@
import './global.css';
import { RootProvider } from 'fumadocs-ui/provider';
import { Inter } from 'next/font/google';
import type { ReactNode } from 'react';
const inter = Inter({
subsets: ['latin'],
});
export default function Layout({ children }: { children: ReactNode }) {
return (
<html lang="en" className={inter.className} suppressHydrationWarning>
<body className="flex min-h-screen flex-col">
<RootProvider>{children}</RootProvider>
</body>
</html>
);
}
+49
View File
@@ -0,0 +1,49 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="500"
zoomAndPan="magnify" viewBox="0 0 375 374.999991" height="500"
preserveAspectRatio="xMidYMid meet" version="1.0">
<defs>
<clipPath id="d101d478a8">
<path d="M 158 130 L 331 130 L 331 359.59375 L 158 359.59375 Z M 158 130 "
clip-rule="nonzero" />
</clipPath>
<clipPath id="ded1a174b8">
<path d="M 158 15.34375 L 173 15.34375 L 173 88 L 158 88 Z M 158 15.34375 "
clip-rule="nonzero" />
</clipPath>
<clipPath id="b1b552b1fc">
<path d="M 43.964844 130 L 116 130 L 116 145 L 43.964844 145 Z M 43.964844 130 "
clip-rule="nonzero" />
</clipPath>
<clipPath id="c8ecf7f480">
<path d="M 170 154 L 294 154 L 294 318.304688 L 170 318.304688 Z M 170 154 "
clip-rule="nonzero" />
</clipPath>
</defs>
<g clip-path="url(#d101d478a8)">
<path fill="#000000"
d="M 327.777344 260.71875 L 170.246094 131.832031 C 168.097656 130.082031 165.148438 129.714844 162.65625 130.914062 C 160.152344 132.09375 158.5625 134.609375 158.5625 137.375 L 158.5625 352.1875 C 158.5625 355.335938 160.636719 358.128906 163.644531 359.046875 C 164.332031 359.246094 165.03125 359.347656 165.71875 359.347656 C 168.070312 359.347656 170.316406 358.1875 171.679688 356.152344 L 226.839844 273.421875 L 323.25 273.421875 C 326.273438 273.421875 328.964844 271.515625 329.996094 268.667969 C 331.011719 265.816406 330.125 262.636719 327.777344 260.71875 Z M 327.777344 260.71875 "
fill-opacity="1" fill-rule="nonzero" />
</g>
<g clip-path="url(#ded1a174b8)">
<path fill="#000000"
d="M 165.71875 15.644531 C 161.765625 15.644531 158.558594 18.855469 158.558594 22.808594 L 158.558594 80.089844 C 158.558594 84.042969 161.765625 87.25 165.71875 87.25 C 169.671875 87.25 172.882812 84.042969 172.882812 80.089844 L 172.882812 22.808594 C 172.882812 18.855469 169.671875 15.644531 165.71875 15.644531 Z M 165.71875 15.644531 "
fill-opacity="1" fill-rule="nonzero" />
</g>
<g clip-path="url(#b1b552b1fc)">
<path fill="#000000"
d="M 108.4375 130.214844 L 51.152344 130.214844 C 47.203125 130.214844 43.992188 133.421875 43.992188 137.375 C 43.992188 141.328125 47.203125 144.539062 51.152344 144.539062 L 108.4375 144.539062 C 112.390625 144.539062 115.597656 141.328125 115.597656 137.375 C 115.597656 133.421875 112.390625 130.214844 108.4375 130.214844 Z M 108.4375 130.214844 "
fill-opacity="1" fill-rule="nonzero" />
</g>
<path fill="#000000"
d="M 280.289062 130.214844 L 223.003906 130.214844 C 219.054688 130.214844 215.84375 133.421875 215.84375 137.375 C 215.84375 141.328125 219.054688 144.539062 223.003906 144.539062 L 280.289062 144.539062 C 284.238281 144.539062 287.449219 141.328125 287.449219 137.375 C 287.449219 133.421875 284.238281 130.214844 280.289062 130.214844 Z M 280.289062 130.214844 "
fill-opacity="1" fill-rule="nonzero" />
<path fill="#000000"
d="M 130.277344 91.804688 L 89.761719 51.304688 C 86.972656 48.511719 82.429688 48.511719 79.636719 51.304688 C 76.847656 54.097656 76.847656 58.636719 79.636719 61.429688 L 120.152344 101.929688 C 121.554688 103.316406 123.386719 104.019531 125.21875 104.019531 C 127.054688 104.019531 128.886719 103.332031 130.277344 101.929688 C 133.070312 99.136719 133.070312 94.597656 130.277344 91.804688 Z M 130.277344 91.804688 "
fill-opacity="1" fill-rule="nonzero" />
<path fill="#000000"
d="M 130.277344 172.832031 C 127.484375 170.039062 122.945312 170.039062 120.152344 172.832031 L 79.636719 213.332031 C 76.84375 216.125 76.84375 220.664062 79.636719 223.457031 C 81.042969 224.847656 82.875 225.550781 84.707031 225.550781 C 86.539062 225.550781 88.375 224.847656 89.761719 223.441406 L 130.277344 182.957031 C 133.070312 180.164062 133.070312 175.625 130.277344 172.832031 Z M 130.277344 172.832031 "
fill-opacity="1" fill-rule="nonzero" />
<path fill="#000000"
d="M 251.789062 51.304688 C 248.996094 48.511719 244.457031 48.511719 241.664062 51.304688 L 201.148438 91.804688 C 198.355469 94.597656 198.355469 99.136719 201.148438 101.929688 C 202.554688 103.316406 204.386719 104.019531 206.222656 104.019531 C 208.054688 104.019531 209.886719 103.332031 211.273438 101.929688 L 251.789062 61.429688 C 254.582031 58.636719 254.582031 54.097656 251.789062 51.304688 Z M 251.789062 51.304688 "
fill-opacity="1" fill-rule="nonzero" />
</svg>

After

Width:  |  Height:  |  Size: 4.5 KiB

+49
View File
@@ -0,0 +1,49 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="500"
zoomAndPan="magnify" viewBox="0 0 375 374.999991" height="500"
preserveAspectRatio="xMidYMid meet" version="1.0">
<defs>
<clipPath id="d101d478a8">
<path d="M 158 130 L 331 130 L 331 359.59375 L 158 359.59375 Z M 158 130 "
clip-rule="nonzero" />
</clipPath>
<clipPath id="ded1a174b8">
<path d="M 158 15.34375 L 173 15.34375 L 173 88 L 158 88 Z M 158 15.34375 "
clip-rule="nonzero" />
</clipPath>
<clipPath id="b1b552b1fc">
<path d="M 43.964844 130 L 116 130 L 116 145 L 43.964844 145 Z M 43.964844 130 "
clip-rule="nonzero" />
</clipPath>
<clipPath id="c8ecf7f480">
<path d="M 170 154 L 294 154 L 294 318.304688 L 170 318.304688 Z M 170 154 "
clip-rule="nonzero" />
</clipPath>
</defs>
<g clip-path="url(#d101d478a8)">
<path fill="#ffffff"
d="M 327.777344 260.71875 L 170.246094 131.832031 C 168.097656 130.082031 165.148438 129.714844 162.65625 130.914062 C 160.152344 132.09375 158.5625 134.609375 158.5625 137.375 L 158.5625 352.1875 C 158.5625 355.335938 160.636719 358.128906 163.644531 359.046875 C 164.332031 359.246094 165.03125 359.347656 165.71875 359.347656 C 168.070312 359.347656 170.316406 358.1875 171.679688 356.152344 L 226.839844 273.421875 L 323.25 273.421875 C 326.273438 273.421875 328.964844 271.515625 329.996094 268.667969 C 331.011719 265.816406 330.125 262.636719 327.777344 260.71875 Z M 327.777344 260.71875 "
fill-opacity="1" fill-rule="nonzero" />
</g>
<g clip-path="url(#ded1a174b8)">
<path fill="#ffffff"
d="M 165.71875 15.644531 C 161.765625 15.644531 158.558594 18.855469 158.558594 22.808594 L 158.558594 80.089844 C 158.558594 84.042969 161.765625 87.25 165.71875 87.25 C 169.671875 87.25 172.882812 84.042969 172.882812 80.089844 L 172.882812 22.808594 C 172.882812 18.855469 169.671875 15.644531 165.71875 15.644531 Z M 165.71875 15.644531 "
fill-opacity="1" fill-rule="nonzero" />
</g>
<g clip-path="url(#b1b552b1fc)">
<path fill="#ffffff"
d="M 108.4375 130.214844 L 51.152344 130.214844 C 47.203125 130.214844 43.992188 133.421875 43.992188 137.375 C 43.992188 141.328125 47.203125 144.539062 51.152344 144.539062 L 108.4375 144.539062 C 112.390625 144.539062 115.597656 141.328125 115.597656 137.375 C 115.597656 133.421875 112.390625 130.214844 108.4375 130.214844 Z M 108.4375 130.214844 "
fill-opacity="1" fill-rule="nonzero" />
</g>
<path fill="#ffffff"
d="M 280.289062 130.214844 L 223.003906 130.214844 C 219.054688 130.214844 215.84375 133.421875 215.84375 137.375 C 215.84375 141.328125 219.054688 144.539062 223.003906 144.539062 L 280.289062 144.539062 C 284.238281 144.539062 287.449219 141.328125 287.449219 137.375 C 287.449219 133.421875 284.238281 130.214844 280.289062 130.214844 Z M 280.289062 130.214844 "
fill-opacity="1" fill-rule="nonzero" />
<path fill="#ffffff"
d="M 130.277344 91.804688 L 89.761719 51.304688 C 86.972656 48.511719 82.429688 48.511719 79.636719 51.304688 C 76.847656 54.097656 76.847656 58.636719 79.636719 61.429688 L 120.152344 101.929688 C 121.554688 103.316406 123.386719 104.019531 125.21875 104.019531 C 127.054688 104.019531 128.886719 103.332031 130.277344 101.929688 C 133.070312 99.136719 133.070312 94.597656 130.277344 91.804688 Z M 130.277344 91.804688 "
fill-opacity="1" fill-rule="nonzero" />
<path fill="#ffffff"
d="M 130.277344 172.832031 C 127.484375 170.039062 122.945312 170.039062 120.152344 172.832031 L 79.636719 213.332031 C 76.84375 216.125 76.84375 220.664062 79.636719 223.457031 C 81.042969 224.847656 82.875 225.550781 84.707031 225.550781 C 86.539062 225.550781 88.375 224.847656 89.761719 223.441406 L 130.277344 182.957031 C 133.070312 180.164062 133.070312 175.625 130.277344 172.832031 Z M 130.277344 172.832031 "
fill-opacity="1" fill-rule="nonzero" />
<path fill="#ffffff"
d="M 251.789062 51.304688 C 248.996094 48.511719 244.457031 48.511719 241.664062 51.304688 L 201.148438 91.804688 C 198.355469 94.597656 198.355469 99.136719 201.148438 101.929688 C 202.554688 103.316406 204.386719 104.019531 206.222656 104.019531 C 208.054688 104.019531 209.886719 103.332031 211.273438 101.929688 L 251.789062 61.429688 C 254.582031 58.636719 254.582031 54.097656 251.789062 51.304688 Z M 251.789062 51.304688 "
fill-opacity="1" fill-rule="nonzero" />
</svg>

After

Width:  |  Height:  |  Size: 4.5 KiB

+9
View File
@@ -0,0 +1,9 @@
import { docs } from "@/.source";
import { loader } from "fumadocs-core/source";
// See https://fumadocs.vercel.app/docs/headless/source-api for more info
export const source = loader({
// it assigns a URL to your pages
baseUrl: "/",
source: docs.toFumadocsSource(),
});
+10
View File
@@ -0,0 +1,10 @@
import defaultMdxComponents from 'fumadocs-ui/mdx';
import type { MDXComponents } from 'mdx/types';
// use this function to get MDX components, you will need it for rendering MDX
export function getMDXComponents(components?: MDXComponents): MDXComponents {
return {
...defaultMdxComponents,
...components,
};
}