-
Notifications
You must be signed in to change notification settings - Fork 417
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
941 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# deps | ||
/node_modules | ||
|
||
# generated content | ||
.map.ts | ||
.contentlayer | ||
.content-collections | ||
|
||
# test & build | ||
/coverage | ||
/.next/ | ||
/out/ | ||
/build | ||
*.tsbuildinfo | ||
|
||
# misc | ||
.DS_Store | ||
*.pem | ||
/.pnp | ||
.pnp.js | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
# others | ||
.env*.local | ||
.vercel | ||
next-env.d.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { getPages } from '@/app/source'; | ||
import { createSearchAPI } from 'fumadocs-core/search/server'; | ||
|
||
export const { GET } = createSearchAPI('advanced', { | ||
indexes: getPages().map((page) => ({ | ||
title: page.data.title, | ||
structuredData: page.data.exports.structuredData, | ||
id: page.url, | ||
url: page.url, | ||
})), | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { getPage, getPages } from '@/app/source'; | ||
import type { Metadata } from 'next'; | ||
import { DocsPage, DocsBody } from 'fumadocs-ui/page'; | ||
import { notFound } from 'next/navigation'; | ||
|
||
export default async function Page({ | ||
params, | ||
}: { | ||
params: { slug?: string[] }; | ||
}) { | ||
const page = getPage(params.slug); | ||
|
||
if (page == null) { | ||
notFound(); | ||
} | ||
|
||
const MDX = page.data.exports.default; | ||
|
||
return ( | ||
<DocsPage toc={page.data.exports.toc} full={page.data.full}> | ||
<DocsBody> | ||
<h1>{page.data.title}</h1> | ||
<MDX /> | ||
</DocsBody> | ||
</DocsPage> | ||
); | ||
} | ||
|
||
export async function generateStaticParams() { | ||
return getPages().map((page) => ({ | ||
slug: page.slugs, | ||
})); | ||
} | ||
|
||
export function generateMetadata({ params }: { params: { slug?: string[] } }) { | ||
const page = getPage(params.slug); | ||
|
||
if (page == null) notFound(); | ||
|
||
return { | ||
title: page.data.title, | ||
description: page.data.description, | ||
} satisfies Metadata; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { DocsLayout } from 'fumadocs-ui/layout'; | ||
import type { ReactNode } from 'react'; | ||
import { docsOptions } from '../layout.config'; | ||
|
||
export default function Layout({ children }: { children: ReactNode }) { | ||
return <DocsLayout {...docsOptions}>{children}</DocsLayout>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
@tailwind base; | ||
@tailwind components; | ||
@tailwind utilities; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { type BaseLayoutProps, type DocsLayoutProps } from 'fumadocs-ui/layout'; | ||
import { pageTree } from '@/app/source'; | ||
|
||
// shared configuration | ||
export const baseOptions: BaseLayoutProps = { | ||
nav: { | ||
title: 'My App', | ||
}, | ||
links: [ | ||
{ | ||
text: 'Documentation', | ||
url: '/docs', | ||
active: 'nested-url', | ||
}, | ||
], | ||
}; | ||
|
||
// docs layout configuration | ||
export const docsOptions: DocsLayoutProps = { | ||
...baseOptions, | ||
tree: pageTree, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import "./global.css"; | ||
import { RootProvider } from "fumadocs-ui/provider"; | ||
import type { ReactNode } from "react"; | ||
import { GeistSans } from "geist/font/sans"; | ||
import { GeistMono } from "geist/font/mono"; | ||
|
||
export default function Layout({ children }: { children: ReactNode }) { | ||
return ( | ||
<html lang="en" className={GeistSans.className} suppressHydrationWarning> | ||
<body> | ||
<RootProvider>{children}</RootProvider> | ||
</body> | ||
</html> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import Link from 'next/link'; | ||
|
||
export default function HomePage() { | ||
return ( | ||
<main className="flex h-screen flex-col justify-center text-center"> | ||
<h1 className="mb-4 text-2xl font-bold">Hello World</h1> | ||
<p className="text-muted-foreground"> | ||
You can open{' '} | ||
<Link href="/docs" className="text-foreground font-semibold underline"> | ||
/docs | ||
</Link>{' '} | ||
and see the documentation. | ||
</p> | ||
</main> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { map } from '@/.map'; | ||
import { createMDXSource } from 'fumadocs-mdx'; | ||
import { loader } from 'fumadocs-core/source'; | ||
|
||
export const { getPage, getPages, pageTree } = loader({ | ||
baseUrl: '/docs', | ||
rootDir: 'docs', | ||
source: createMDXSource(map), | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
title: Hello World | ||
description: Your first document | ||
--- | ||
|
||
Welcome to the docs! You can start writing documents in `/content/docs`. | ||
|
||
## What is Next? | ||
|
||
<Cards> | ||
<Card title="Learn more about Next.js" href="https://nextjs.org/docs" /> | ||
<Card title="Learn more about Fumadocs" href="https://fumadocs.vercel.app" /> | ||
</Cards> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
title: Components | ||
description: Components | ||
--- | ||
|
||
## Code Block | ||
|
||
```js | ||
console.log('Hello World'); | ||
``` | ||
|
||
## Cards | ||
|
||
<Cards> | ||
<Card title="Learn more about Next.js" href="https://nextjs.org/docs" /> | ||
<Card title="Learn more about Fumadocs" href="https://fumadocs.vercel.app" /> | ||
</Cards> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import type { MDXComponents } from 'mdx/types'; | ||
import defaultComponents from 'fumadocs-ui/mdx'; | ||
|
||
export function useMDXComponents(components: MDXComponents): MDXComponents { | ||
return { | ||
...defaultComponents, | ||
...components, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import createMDX from "fumadocs-mdx/config"; | ||
|
||
const withMDX = createMDX(); | ||
|
||
/** @type {import('next').NextConfig} */ | ||
const config = {}; | ||
|
||
export default withMDX(config); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"name": "docs", | ||
"version": "0.0.0", | ||
"private": true, | ||
"scripts": { | ||
"build": "next build", | ||
"dev": "next dev", | ||
"start": "next start" | ||
}, | ||
"dependencies": { | ||
"fumadocs-core": "12.4.1", | ||
"fumadocs-mdx": "8.2.33", | ||
"fumadocs-ui": "12.4.1", | ||
"geist": "^1.3.0", | ||
"next": "^14.2.4", | ||
"react": "^18.3.1", | ||
"react-dom": "^18.3.1" | ||
}, | ||
"devDependencies": { | ||
"@types/mdx": "^2.0.13", | ||
"@types/react": "^18.3.3", | ||
"@types/react-dom": "^18.3.0", | ||
"autoprefixer": "^10.4.19", | ||
"postcss": "^8.4.39", | ||
"tailwindcss": "^3.4.4", | ||
"typescript": "^5.5.3" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module.exports = { | ||
plugins: { | ||
tailwindcss: {}, | ||
autoprefixer: {}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { createPreset } from 'fumadocs-ui/tailwind-plugin'; | ||
|
||
/** @type {import('tailwindcss').Config} */ | ||
export default { | ||
content: [ | ||
'./components/**/*.{ts,tsx}', | ||
'./app/**/*.{ts,tsx}', | ||
'./content/**/*.{md,mdx}', | ||
'./mdx-components.{ts,tsx}', | ||
'./node_modules/fumadocs-ui/dist/**/*.js', | ||
], | ||
presets: [createPreset()], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
"compilerOptions": { | ||
"baseUrl": ".", | ||
"target": "ESNext", | ||
"lib": ["dom", "dom.iterable", "esnext"], | ||
"allowJs": true, | ||
"skipLibCheck": true, | ||
"strict": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"noEmit": true, | ||
"esModuleInterop": true, | ||
"module": "esnext", | ||
"moduleResolution": "node", | ||
"resolveJsonModule": true, | ||
"isolatedModules": true, | ||
"jsx": "preserve", | ||
"incremental": true, | ||
"paths": { | ||
"@/*": ["./*"] | ||
}, | ||
"plugins": [ | ||
{ | ||
"name": "next" | ||
} | ||
] | ||
}, | ||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], | ||
"exclude": ["node_modules"] | ||
} |
Oops, something went wrong.