first commit
This commit is contained in:
45
apps/docs/app/docs/[slug]/page.tsx
Normal file
45
apps/docs/app/docs/[slug]/page.tsx
Normal file
@@ -0,0 +1,45 @@
|
||||
import { notFound } from 'next/navigation';
|
||||
import { DocBlockRenderer } from '@/components/doc-block-renderer';
|
||||
import { DocsToc } from '@/components/docs-shell';
|
||||
import { getAllDocSlugs, getDocPage } from '@/lib/docs-pages';
|
||||
|
||||
export function generateStaticParams() {
|
||||
return getAllDocSlugs().map((slug) => ({ slug }));
|
||||
}
|
||||
|
||||
export default async function DocPage({ params }: { params: Promise<{ slug: string }> }) {
|
||||
const { slug } = await params;
|
||||
const page = getDocPage(slug);
|
||||
if (!page) notFound();
|
||||
|
||||
return (
|
||||
<>
|
||||
<main className="min-w-0 max-w-3xl prose-docs">
|
||||
<div className="mb-10 border-b border-zinc-200 pb-8 dark:border-zinc-800">
|
||||
<p className="text-sm font-medium text-zinc-500">Документация</p>
|
||||
<h1 className="mt-2 text-4xl font-bold tracking-tight text-zinc-950 dark:text-zinc-50">{page.title}</h1>
|
||||
<p className="mt-4 text-lg leading-relaxed text-zinc-600 dark:text-zinc-400">{page.description}</p>
|
||||
</div>
|
||||
|
||||
<article className="space-y-12 pb-16">
|
||||
{page.sections.map((section) => (
|
||||
<section id={section.id} key={section.id} className="scroll-mt-24">
|
||||
<h2 className="mb-4 text-2xl font-semibold tracking-tight text-zinc-950 dark:text-zinc-50">{section.title}</h2>
|
||||
<div className="space-y-4">
|
||||
{section.blocks.map((block, index) => (
|
||||
<DocBlockRenderer key={`${section.id}-${index}`} block={block} />
|
||||
))}
|
||||
</div>
|
||||
</section>
|
||||
))}
|
||||
</article>
|
||||
</main>
|
||||
|
||||
<aside className="hidden xl:block">
|
||||
<div className="sticky top-20">
|
||||
<DocsToc sections={page.sections.map((s) => ({ id: s.id, title: s.title }))} />
|
||||
</div>
|
||||
</aside>
|
||||
</>
|
||||
);
|
||||
}
|
||||
27
apps/docs/app/docs/layout.tsx
Normal file
27
apps/docs/app/docs/layout.tsx
Normal file
@@ -0,0 +1,27 @@
|
||||
import { docNavigation, groupDocNavigation } from '@/lib/navigation';
|
||||
import { fetchPublicSettings } from '@/lib/api';
|
||||
import { PublicSettingsProvider } from '@/providers/public-settings-provider';
|
||||
import { DocsHeader, DocsSidebar } from '@/components/docs-shell';
|
||||
|
||||
export const dynamic = 'force-dynamic';
|
||||
|
||||
export default async function DocsLayout({ children }: { children: React.ReactNode }) {
|
||||
const initialSettings = await fetchPublicSettings();
|
||||
const groups = groupDocNavigation(docNavigation);
|
||||
|
||||
return (
|
||||
<PublicSettingsProvider initialSettings={initialSettings}>
|
||||
<div className="min-h-screen bg-white dark:bg-zinc-950">
|
||||
<DocsHeader />
|
||||
<div className="mx-auto grid max-w-screen-2xl grid-cols-1 gap-8 px-4 py-8 lg:grid-cols-[240px_minmax(0,1fr)] lg:px-8 xl:grid-cols-[240px_minmax(0,1fr)_200px]">
|
||||
<aside className="hidden lg:block">
|
||||
<div className="sticky top-20">
|
||||
<DocsSidebar groups={groups} />
|
||||
</div>
|
||||
</aside>
|
||||
{children}
|
||||
</div>
|
||||
</div>
|
||||
</PublicSettingsProvider>
|
||||
);
|
||||
}
|
||||
5
apps/docs/app/docs/page.tsx
Normal file
5
apps/docs/app/docs/page.tsx
Normal file
@@ -0,0 +1,5 @@
|
||||
import { DocsHomeContent } from '@/components/docs-home-content';
|
||||
|
||||
export default function DocsHomePage() {
|
||||
return <DocsHomeContent />;
|
||||
}
|
||||
Reference in New Issue
Block a user