Skip to content

Commit 8a8f269

Browse files
committed
feat: rewrite docs site
1 parent 5f7a48e commit 8a8f269

File tree

103 files changed

+5332
-908
lines changed

Some content is hidden

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

103 files changed

+5332
-908
lines changed

apps/docs/.eslintrc.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": ["next/core-web-vitals", "next/typescript"]
3+
}

apps/docs/.gitignore

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,28 @@
1-
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2-
3-
# dependencies
1+
# deps
42
/node_modules
5-
/.pnp
6-
.pnp.js
73

8-
# testing
9-
/coverage
4+
# generated content
5+
.contentlayer
6+
.content-collections
7+
.source
108

11-
# next.js
9+
# test & build
10+
/coverage
1211
/.next/
1312
/out/
14-
15-
# production
1613
/build
14+
*.tsbuildinfo
1715

1816
# misc
1917
.DS_Store
2018
*.pem
21-
22-
# debug
19+
/.pnp
20+
.pnp.js
2321
npm-debug.log*
2422
yarn-debug.log*
2523
yarn-error.log*
2624

27-
# local env files
25+
# others
2826
.env*.local
29-
30-
# vercel
3127
.vercel
32-
33-
# typescript
34-
*.tsbuildinfo
35-
next-env.d.ts
28+
next-env.d.ts

apps/docs/README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# docs
2+
3+
This is a Next.js application generated with
4+
[Create Fumadocs](https://github.com/fuma-nama/fumadocs).
5+
6+
Run development server:
7+
8+
```bash
9+
npm run dev
10+
# or
11+
pnpm dev
12+
# or
13+
yarn dev
14+
```
15+
16+
Open http://localhost:3000 with your browser to see the result.
17+
18+
## Learn More
19+
20+
To learn more about Next.js and Fumadocs, take a look at the following
21+
resources:
22+
23+
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js
24+
features and API.
25+
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
26+
- [Fumadocs](https://fumadocs.vercel.app) - learn about Fumadocs

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import type { ReactNode } from 'react';
2+
import { HomeLayout } from 'fumadocs-ui/layouts/home';
3+
import { baseOptions } from '@/app/layout.config';
4+
5+
export default function Layout({
6+
children,
7+
}: {
8+
children: ReactNode;
9+
}): React.ReactElement {
10+
return <HomeLayout {...baseOptions}>{children}</HomeLayout>;
11+
}

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

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
import { Card, Cards } from '@/components/card';
2+
import { Heading } from '@/components/heading';
3+
import Link from 'next/link';
4+
5+
// export default function HomePage() {
6+
// return (
7+
// <main className="flex flex-1 flex-col justify-center text-center">
8+
// <h1 className="mb-4 text-2xl font-bold">Hello World</h1>
9+
// <p className="text-fd-muted-foreground">
10+
// You can open{' '}
11+
// <Link
12+
// href="/docs"
13+
// className="text-fd-foreground font-semibold underline"
14+
// >
15+
// /docs
16+
// </Link>{' '}
17+
// and see the documentation.
18+
// </p>
19+
// </main>
20+
// );
21+
// }
22+
23+
const features = [
24+
{
25+
title: 'Beginner friendly 🚀',
26+
description: 'CommandKit aims to be beginner friendly.',
27+
},
28+
{
29+
title: 'Slash + context menu commands support ✅',
30+
description: 'CommandKit supports slash and context menu commands.',
31+
},
32+
{
33+
title: 'Multiple dev guilds, users, & roles support 🤝',
34+
description: 'CommandKit supports multiple dev guilds, users, and roles.',
35+
},
36+
{
37+
title: 'Automatic command updates 🤖',
38+
description: 'CommandKit automatically updates commands.',
39+
},
40+
{
41+
title: 'REST registration behaviour 📍',
42+
description: 'CommandKit has REST registration behaviour.',
43+
},
44+
{
45+
title: 'And much more! 🧪',
46+
description: 'CommandKit has much more features.',
47+
},
48+
];
49+
50+
export default function HomePage() {
51+
return (
52+
<>
53+
<section className="w-72 h-96 mx-auto text-center mt-20 mb-28 md:mb-16 flex items-center justify-center flex-col md:flex-row-reverse md:gap-2 md:text-left md:mt-12 md:w-[700px] lg:w-[850px]">
54+
{/* eslint-disable-next-line @next/next/no-img-element */}
55+
<img
56+
src="/logo.png"
57+
alt="CommandKit Logo"
58+
className="md:w-[230px] lg:w-[280px] mb-10 md:mb-0"
59+
width={200}
60+
height={200}
61+
/>
62+
63+
<div>
64+
<p className="text-4xl font-bold mb-5 md:text-5xl lg:text-6xl">
65+
Let{' '}
66+
<span className="text-transparent bg-clip-text bg-gradient-to-r from-[#ffbc6f] to-[#b079fc]">
67+
CommandKit
68+
</span>{' '}
69+
handle it for you!
70+
</p>
71+
<p className="font-semibold lg:text-xl">
72+
A Discord.js handler for commands and events.
73+
</p>
74+
75+
<div className="flex items-center justify-center gap-3 mt-10 md:justify-start text-neutral-100">
76+
<Link
77+
href="/guide/installation"
78+
className="font-semibold bg-[#b079fc] py-2 px-4 rounded-full"
79+
>
80+
Guide
81+
</Link>
82+
<Link
83+
href="/docs/typedef/AutocompleteProps"
84+
className="font-semibold bg-blue-500 py-2 px-4 rounded-full"
85+
>
86+
Docs
87+
</Link>
88+
<Link
89+
href="https://github.com/underctrl-io/commandkit"
90+
className="font-semibold bg-[#fc7993] py-2 px-4 rounded-full"
91+
target="_blank"
92+
rel="noopener noreferrer"
93+
>
94+
GitHub
95+
</Link>
96+
</div>
97+
</div>
98+
</section>
99+
<section className="max-w-[400px] md:max-w-none mx-auto md:w-[700px] lg:w-[850px] text-fd-foreground">
100+
<Heading as="h1" className="text-lg font-semibold mb-2">
101+
Features
102+
</Heading>
103+
<Cards>
104+
{features.map((feature) => (
105+
<Card
106+
key={feature.title}
107+
title={feature.title}
108+
description={feature.description}
109+
/>
110+
))}
111+
</Cards>
112+
</section>
113+
</>
114+
);
115+
}

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/api-source';
2+
import { createFromSource } from 'fumadocs-core/search/server';
3+
4+
export const { GET } = createFromSource(source);
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
import { source } from '@/lib/api-source';
2+
import {
3+
DocsPage,
4+
DocsBody,
5+
DocsDescription,
6+
DocsTitle,
7+
} from 'fumadocs-ui/page';
8+
import { notFound } from 'next/navigation';
9+
import defaultMdxComponents from 'fumadocs-ui/mdx';
10+
import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
11+
import { CodeBlock, Pre } from 'fumadocs-ui/components/codeblock';
12+
import { Callout } from 'fumadocs-ui/components/callout';
13+
14+
export default async function Page(props: {
15+
params: Promise<{ slug?: string[] }>;
16+
}) {
17+
const params = await props.params;
18+
const page = source.getPage(params.slug);
19+
if (!page) notFound();
20+
21+
const MDX = page.data.body;
22+
23+
return (
24+
<DocsPage toc={page.data.toc} full={page.data.full}>
25+
<DocsTitle>{page.data.title}</DocsTitle>
26+
<DocsDescription>{page.data.description}</DocsDescription>
27+
<DocsBody>
28+
<MDX
29+
components={{
30+
...defaultMdxComponents,
31+
Tab,
32+
Tabs,
33+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
34+
pre: ({ ref: _ref, ...props }) => (
35+
<CodeBlock {...props}>
36+
<Pre>{props.children}</Pre>
37+
</CodeBlock>
38+
),
39+
Callout,
40+
}}
41+
/>
42+
</DocsBody>
43+
</DocsPage>
44+
);
45+
}
46+
47+
export async function generateStaticParams() {
48+
return source.generateParams();
49+
}
50+
51+
export async function generateMetadata(props: {
52+
params: Promise<{ slug?: string[] }>;
53+
}) {
54+
const params = await props.params;
55+
const page = source.getPage(params.slug);
56+
if (!page) notFound();
57+
58+
return {
59+
title: page.data.title,
60+
description: page.data.description,
61+
};
62+
}

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/api-source';
5+
6+
export default function Layout({ children }: { children: ReactNode }) {
7+
return (
8+
<DocsLayout tree={source.pageTree} {...baseOptions}>
9+
{children}
10+
</DocsLayout>
11+
);
12+
}
File renamed without changes.
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
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 defaultMdxComponents from 'fumadocs-ui/mdx';
10+
import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
11+
import { CodeBlock, Pre } from 'fumadocs-ui/components/codeblock';
12+
import { Callout } from 'fumadocs-ui/components/callout';
13+
14+
export default async function Page(props: {
15+
params: Promise<{ slug?: string[] }>;
16+
}) {
17+
const params = await props.params;
18+
const page = source.getPage(params.slug);
19+
if (!page) notFound();
20+
21+
const MDX = page.data.body;
22+
23+
return (
24+
<DocsPage toc={page.data.toc} full={page.data.full}>
25+
<DocsTitle>{page.data.title}</DocsTitle>
26+
<DocsDescription>{page.data.description}</DocsDescription>
27+
<DocsBody>
28+
<MDX
29+
components={{
30+
...defaultMdxComponents,
31+
Tab,
32+
Tabs,
33+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
34+
pre: ({ ref: _ref, ...props }) => (
35+
<CodeBlock {...props}>
36+
<Pre>{props.children}</Pre>
37+
</CodeBlock>
38+
),
39+
Callout,
40+
}}
41+
/>
42+
</DocsBody>
43+
</DocsPage>
44+
);
45+
}
46+
47+
export async function generateStaticParams() {
48+
return source.generateParams();
49+
}
50+
51+
export async function generateMetadata(props: {
52+
params: Promise<{ slug?: string[] }>;
53+
}) {
54+
const params = await props.params;
55+
const page = source.getPage(params.slug);
56+
if (!page) notFound();
57+
58+
return {
59+
title: page.data.title,
60+
description: page.data.description,
61+
};
62+
}

0 commit comments

Comments
 (0)