Skip to content

Commit 448af51

Browse files
feat(docs): Migrate documentation from Nextra to fumaDocs, upgrade to react 19 (#178)
Co-authored-by: Bennett <[email protected]>
1 parent 00ec91c commit 448af51

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+1220
-24612
lines changed

apps/docs/.github/screenshot.png

-868 KB
Binary file not shown.

apps/docs/.gitignore

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,30 @@
1+
# deps
12
.next
23
node_modules
4+
/node_modules
5+
6+
# generated content
7+
.contentlayer
8+
.content-collections
9+
.source
10+
11+
# test & build
12+
/coverage
13+
/.next/
14+
/out/
15+
/build
16+
*.tsbuildinfo
17+
18+
# misc
19+
.DS_Store
20+
*.pem
21+
/.pnp
22+
.pnp.js
23+
npm-debug.log*
24+
yarn-debug.log*
25+
yarn-error.log*
26+
27+
# others
28+
.env*.local
29+
.vercel
30+
next-env.d.ts

apps/docs/README.md

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,45 @@
1-
# Nextra Docs Template
1+
# docs
22

3-
This is a template for creating documentation with [Nextra](https://nextra.site).
3+
This is a Next.js application generated with
4+
[Create Fumadocs](https://github.com/fuma-nama/fumadocs).
45

5-
[**Live Demo →**](https://nextra-docs-template.vercel.app)
6+
Run development server:
67

7-
[![](.github/screenshot.png)](https://nextra-docs-template.vercel.app)
8+
```bash
9+
npm run dev
10+
# or
11+
pnpm dev
12+
# or
13+
yarn dev
14+
```
815

9-
## Quick Start
16+
Open http://localhost:3000 with your browser to see the result.
1017

11-
Click the button to clone this repository and deploy it on Vercel:
18+
## Explore
1219

13-
[![](https://vercel.com/button)](https://vercel.com/new/clone?s=https%3A%2F%2Fgithub.com%2Fshuding%2Fnextra-docs-template&showOptionalTeamCreation=false)
20+
In the project, you can see:
1421

15-
## Local Development
22+
- `lib/source.ts`: Code for content source adapter, [`loader()`](https://fumadocs.dev/docs/headless/source-api) provides the interface to access your content.
23+
- `app/layout.config.tsx`: Shared options for layouts, optional but preferred to keep.
1624

17-
First, run `pnpm i` to install the dependencies.
25+
| Route | Description |
26+
| ------------------------- | ------------------------------------------------------ |
27+
| `app/(home)` | The route group for your landing page and other pages. |
28+
| `app/docs` | The documentation layout and pages. |
29+
| `app/api/search/route.ts` | The Route Handler for search. |
1830

19-
Then, run `pnpm dev` to start the development server and visit localhost:3000.
31+
### Fumadocs MDX
2032

21-
## License
33+
A `source.config.ts` config file has been included, you can customise different options like frontmatter schema.
2234

23-
This project is licensed under the MIT License.
35+
Read the [Introduction](https://fumadocs.dev/docs/mdx) for further details.
36+
37+
## Learn More
38+
39+
To learn more about Next.js and Fumadocs, take a look at the following
40+
resources:
41+
42+
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js
43+
features and API.
44+
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
45+
- [Fumadocs](https://fumadocs.vercel.app) - learn about Fumadocs

apps/docs/app/(home)/page.tsx

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// import { BenefitsSection } from "@/components/landing/sections/benefits";
2+
// import { CommunitySection } from "@/components/landing/sections/community";
3+
// import { ContactSection } from "@/components/landing/sections/contact";
4+
// import { FAQSection } from "@/components/landing/sections/faq";
5+
// import { FeaturesSection } from "@/components/landing/sections/features";
6+
// import { FooterSection } from "@/components/landing/sections/footer";
7+
// import { PricingSection } from "@/components/landing/sections/pricing";
8+
// import { ServicesSection } from "@/components/landing/sections/services";
9+
// import { SponsorsSection } from "@/components/landing/sections/sponsors";
10+
// import { TeamSection } from "@/components/landing/sections/team";
11+
// import { TestimonialSection } from "@/components/landing/sections/testimonial";
12+
import { Navbar } from "@/components/landing/navbar";
13+
import { HeroSection } from "@/components/landing/sections/hero";
14+
15+
export default function Home() {
16+
return (
17+
<div className="min-h-screen bg-background p-6 flex flex-col items-center">
18+
<title>AutoForm - Instant forms for your schemas</title>
19+
20+
<Navbar />
21+
<HeroSection />
22+
{/* <SponsorsSection /> */}
23+
{/* <BenefitsSection />
24+
<FeaturesSection />
25+
<ServicesSection />
26+
<TestimonialSection />
27+
<TeamSection />
28+
<CommunitySection />
29+
<PricingSection />
30+
<ContactSection />
31+
<FAQSection />
32+
<FooterSection />
33+
*/}
34+
</div>
35+
);
36+
}

apps/docs/app/api/search/route.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import { source } from '@/lib/source';
2+
import { createFromSource } from 'fumadocs-core/search/server';
3+
4+
export const { GET } = createFromSource(source);
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import { source } from "@/lib/source";
2+
import {
3+
DocsPage,
4+
DocsBody,
5+
DocsDescription,
6+
DocsTitle,
7+
} from "fumadocs-ui/page";
8+
import { notFound } from "next/navigation";
9+
import { createRelativeLink } from "fumadocs-ui/mdx";
10+
import { getMDXComponents } from "@/mdx-components";
11+
12+
export default async function Page(props: {
13+
params: Promise<{ slug?: string[] }>;
14+
}) {
15+
const params = await props.params;
16+
const page = source.getPage(params.slug);
17+
if (!page) notFound();
18+
19+
const MDXContent = page.data.body;
20+
21+
return (
22+
<DocsPage toc={page.data.toc} full={page.data.full}>
23+
<DocsTitle>{page.data.title}</DocsTitle>
24+
<DocsDescription>{page.data.description}</DocsDescription>
25+
<DocsBody>
26+
<MDXContent
27+
components={getMDXComponents({
28+
// this allows you to link to other pages with relative file paths
29+
a: createRelativeLink(source, page),
30+
})}
31+
/>
32+
</DocsBody>
33+
</DocsPage>
34+
);
35+
}
36+
37+
export async function generateStaticParams() {
38+
return source.generateParams();
39+
}
40+
41+
export async function generateMetadata(props: {
42+
params: Promise<{ slug?: string[] }>;
43+
}) {
44+
const params = await props.params;
45+
const page = source.getPage(params.slug);
46+
if (!page) notFound();
47+
48+
return {
49+
title: `${page.data.title} | Autoform`,
50+
description: page.data.description,
51+
};
52+
}

apps/docs/app/docs/layout.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { DocsLayout } from "fumadocs-ui/layouts/docs";
2+
import type { ReactNode } from "react";
3+
import { baseOptions } from "@/app/layout.config";
4+
import { source } from "@/lib/source";
5+
6+
export default function Layout({ children }: { children: ReactNode }) {
7+
return (
8+
<DocsLayout tree={source.pageTree} {...baseOptions}>
9+
{children}
10+
</DocsLayout>
11+
);
12+
}

apps/docs/app/global.css

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
@import "tailwindcss";
2+
@import "fumadocs-ui/css/neutral.css";
3+
@import "fumadocs-ui/css/preset.css";
4+
5+
@theme {
6+
--color-background: hsl(0 0% 100%);
7+
--color-foreground: hsl(240 10% 3.9%);
8+
--color-card: hsl(0 0% 100%);
9+
--color-card-foreground: hsl(240 10% 3.9%);
10+
--color-popover: hsl(0 0% 100%);
11+
--color-popover-foreground: hsl(240 10% 3.9%);
12+
--color-primary: hsl(24.6 95% 53.1%);
13+
--color-primary-foreground: hsl(60 9.1% 97.8%);
14+
--color-secondary: hsl(240 4.8% 95.9%);
15+
--color-secondary-foreground: hsl(240 5.9% 10%);
16+
--color-muted: hsl(240 4.8% 95.9%);
17+
--color-muted-foreground: hsl(240 3.8% 46.1%);
18+
--color-accent: hsl(240 4.8% 95.9%);
19+
--color-accent-foreground: hsl(240 5.9% 10%);
20+
--color-destructive: hsl(0 84.2% 60.2%);
21+
--color-destructive-foreground: hsl(0 0% 98%);
22+
--color-border: hsl(240 5.9% 90%);
23+
--color-input: hsl(240 5.9% 90%);
24+
--color-ring: hsl(240 10% 3.9%);
25+
--color-chart-1: hsl(12 76% 61%);
26+
--color-chart-2: hsl(173 58% 39%);
27+
--color-chart-3: hsl(197 37% 24%);
28+
--color-chart-4: hsl(43 74% 66%);
29+
--color-chart-5: hsl(27 87% 67%);
30+
--radius: 0.5rem;
31+
32+
/* Fumadocs colors (light mode) */
33+
--color-fd-background: hsl(0 0% 100%);
34+
--color-fd-card: hsl(240, 14%, 98%);
35+
--color-fd-secondary: hsl(240, 20%, 95%);
36+
--color-fd-primary: hsl(0, 0%, 15%);
37+
}
38+
39+
.dark {
40+
--color-background: hsl(240 10% 3.9%);
41+
--color-foreground: hsl(0 0% 98%);
42+
--color-card: hsl(240 10% 3.9%);
43+
--color-card-foreground: hsl(0 0% 98%);
44+
--color-popover: hsl(240 10% 3.9%);
45+
--color-popover-foreground: hsl(0 0% 98%);
46+
--color-primary: hsl(0 0% 98%);
47+
--color-primary-foreground: hsl(240 5.9% 10%);
48+
--color-secondary: hsl(240 3.7% 15.9%);
49+
--color-secondary-foreground: hsl(0 0% 98%);
50+
--color-muted: hsl(240 3.7% 15.9%);
51+
--color-muted-foreground: hsl(240 5% 64.9%);
52+
--color-accent: hsl(240 3.7% 15.9%);
53+
--color-accent-foreground: hsl(0 0% 98%);
54+
--color-destructive: hsl(0 62.8% 30.6%);
55+
--color-destructive-foreground: hsl(0 0% 98%);
56+
--color-border: hsl(240 3.7% 15.9%);
57+
--color-input: hsl(240 3.7% 15.9%);
58+
--color-ring: hsl(240 4.9% 83.9%);
59+
--color-chart-1: hsl(220 70% 50%);
60+
--color-chart-2: hsl(160 60% 45%);
61+
--color-chart-3: hsl(30 80% 55%);
62+
--color-chart-4: hsl(280 65% 60%);
63+
--color-chart-5: hsl(340 75% 55%);
64+
}

apps/docs/app/layout.config.tsx

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import type { BaseLayoutProps } from "fumadocs-ui/layouts/shared";
2+
import { ChevronsDown } from "lucide-react";
3+
/**
4+
* Shared layout configurations
5+
*
6+
* you can customise layouts individually from:
7+
* Home Layout: app/(home)/layout.tsx
8+
* Docs Layout: app/docs/layout.tsx
9+
*/
10+
export const baseOptions: BaseLayoutProps = {
11+
nav: {
12+
title: (
13+
<div className="flex items-center gap-2">
14+
<ChevronsDown className="bg-gradient-to-tr border-secondary from-primary via-primary/70 to-primary rounded-lg w-9 h-9 mr-2 border text-white" />
15+
AutoForm
16+
</div>
17+
),
18+
transparentMode: "top",
19+
},
20+
// see https://fumadocs.dev/docs/ui/navigation/links
21+
links: [],
22+
githubUrl: "https://github.com/vantezzen/autoform.git",
23+
};

apps/docs/app/layout.tsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import './global.css';
2+
import { RootProvider } from 'fumadocs-ui/provider';
3+
import { Inter } from 'next/font/google';
4+
import type { ReactNode } from 'react';
5+
6+
const inter = Inter({
7+
subsets: ['latin'],
8+
});
9+
10+
export default function Layout({ children }: { children: ReactNode }) {
11+
return (
12+
<html lang="en" className={inter.className} suppressHydrationWarning>
13+
<body className="flex flex-col min-h-screen">
14+
<RootProvider>{children}</RootProvider>
15+
</body>
16+
</html>
17+
);
18+
}

0 commit comments

Comments
 (0)