Initial push of Plunk Next
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
import {createRelativeLink} from 'fumadocs-ui/mdx';
|
||||
import {DocsBody, DocsDescription, DocsPage, DocsTitle} from 'fumadocs-ui/page';
|
||||
import {notFound} from 'next/navigation';
|
||||
|
||||
import {source} from '@/lib/source';
|
||||
import {getMDXComponents} from '@/mdx-components';
|
||||
|
||||
export const dynamic = 'force-dynamic';
|
||||
|
||||
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({
|
||||
a: createRelativeLink(source, page),
|
||||
})}
|
||||
/>
|
||||
</DocsBody>
|
||||
</DocsPage>
|
||||
);
|
||||
}
|
||||
|
||||
export 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,
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
import {createFromSource} from 'fumadocs-core/search/server';
|
||||
|
||||
import {source} from '@/lib/source';
|
||||
|
||||
export const {GET} = createFromSource(source);
|
||||
@@ -0,0 +1,8 @@
|
||||
@import 'tailwindcss';
|
||||
@import 'fumadocs-ui/css/neutral.css';
|
||||
@import 'fumadocs-ui/css/preset.css';
|
||||
@import 'fumadocs-openapi/css/preset.css';
|
||||
|
||||
body {
|
||||
font-family: 'Inter', sans-serif;
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
import type {BaseLayoutProps} from 'fumadocs-ui/layouts/shared';
|
||||
import {AppWindowIcon, GithubIcon, MessageSquareShareIcon} from 'lucide-react';
|
||||
import Image from 'next/image';
|
||||
import React from '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 = {
|
||||
themeSwitch: {
|
||||
enabled: false,
|
||||
},
|
||||
nav: {
|
||||
title: (
|
||||
<div className="flex items-center gap-2">
|
||||
<Image src="/assets/logo.png" alt="Plunk" width={24} height={24} className="rounded" />
|
||||
<span>Plunk</span>
|
||||
</div>
|
||||
),
|
||||
},
|
||||
links: [
|
||||
{
|
||||
icon: <AppWindowIcon />,
|
||||
text: 'Dashboard',
|
||||
url: 'https://app.useplunk.com',
|
||||
},
|
||||
{
|
||||
icon: <GithubIcon />,
|
||||
text: 'GitHub',
|
||||
url: 'https://github.com/useplunk/plunk',
|
||||
},
|
||||
{
|
||||
icon: <MessageSquareShareIcon />,
|
||||
text: 'Discord',
|
||||
url: 'https://useplunk.com/discord',
|
||||
},
|
||||
],
|
||||
};
|
||||
@@ -0,0 +1,80 @@
|
||||
import './global.css';
|
||||
import {DocsLayout} from 'fumadocs-ui/layouts/docs';
|
||||
import {RootProvider} from 'fumadocs-ui/provider/next';
|
||||
import type {ReactNode} from 'react';
|
||||
import React from 'react';
|
||||
|
||||
import {baseOptions} from '@/app/layout.config';
|
||||
import {source} from '@/lib/source';
|
||||
|
||||
export default function Layout({children}: {children: ReactNode}) {
|
||||
return (
|
||||
<html lang="en" suppressHydrationWarning>
|
||||
<head>
|
||||
{/* Runtime environment configuration - must load before any app code */}
|
||||
{/* eslint-disable-next-line @next/next/no-sync-scripts */}
|
||||
<script src="/__env.js" />
|
||||
|
||||
{/* Primary Meta Tags */}
|
||||
<title>Plunk Documentation</title>
|
||||
<meta name="title" content="Plunk Documentation" />
|
||||
<meta
|
||||
name="description"
|
||||
content="Documentation for Plunk, the open-source email platform. Learn how to integrate Plunk into your application and manage your email communications."
|
||||
/>
|
||||
|
||||
{/* Open Graph / Facebook */}
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:url" content="https://docs.useplunk.com/" />
|
||||
<meta property="og:title" content="Plunk Documentation" />
|
||||
<meta
|
||||
property="og:description"
|
||||
content="Documentation for Plunk, the open-source email platform. Learn how to integrate Plunk into your application and manage your email communications."
|
||||
/>
|
||||
<meta property="og:image" content="https://docs.useplunk.com/assets/card.png" />
|
||||
|
||||
{/* Twitter */}
|
||||
<meta property="twitter:card" content="summary_large_image" />
|
||||
<meta property="twitter:url" content="https://docs.useplunk.com/" />
|
||||
<meta property="twitter:title" content="Plunk Documentation" />
|
||||
<meta
|
||||
property="twitter:description"
|
||||
content="Documentation for Plunk, the open-source email platform. Learn how to integrate Plunk into your application and manage your email communications."
|
||||
/>
|
||||
<meta property="twitter:image" content="https://docs.useplunk.com/assets/card.png" />
|
||||
|
||||
{/* Fonts */}
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossOrigin="anonymous" />
|
||||
{/* eslint-disable-next-line @next/next/no-page-custom-font */}
|
||||
<link
|
||||
href="https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900&display=swap"
|
||||
rel="stylesheet"
|
||||
/>
|
||||
|
||||
{/* Favicon */}
|
||||
<link rel="icon" type="image/png" href="/favicon/favicon-32x32.png" sizes="32x32" />
|
||||
<link rel="icon" type="image/png" href="/favicon/favicon-16x16.png" sizes="16x16" />
|
||||
<link rel="shortcut icon" href="/favicon/favicon.ico" />
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="/favicon/apple-touch-icon.png" />
|
||||
<link rel="mask-icon" href="/favicon/safari-pinned-tab.svg" color="#5bbad5" />
|
||||
<meta name="apple-mobile-web-app-title" content="Plunk" />
|
||||
<meta name="application-name" content="Plunk" />
|
||||
<meta name="msapplication-TileColor" content="#da532c" />
|
||||
<meta name="theme-color" content="#ffffff" />
|
||||
<link rel="manifest" href="/favicon/site.webmanifest" />
|
||||
</head>
|
||||
<body className="flex flex-col min-h-screen antialiased text-neutral-800" suppressHydrationWarning>
|
||||
<RootProvider
|
||||
theme={{
|
||||
enabled: false,
|
||||
}}
|
||||
>
|
||||
<DocsLayout tree={source.pageTree} {...baseOptions}>
|
||||
{children}
|
||||
</DocsLayout>
|
||||
</RootProvider>
|
||||
</body>
|
||||
</html>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user