mirror of
https://github.com/Nezumi-2711/9router.git
synced 2026-09-22 13:38:31 +00:00
Feat : Gitbook
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
import DocsLayout from "@/components/DocsLayout";
|
||||
import DocsContent from "@/components/DocsContent";
|
||||
import { extractHeadings } from "@/utils/markdown";
|
||||
import { loadContent, getAllSlugs } from "@/lib/content";
|
||||
import { LANG_CODES, isValidLang, DEFAULT_LANG } from "@/constants/languages";
|
||||
import { notFound } from "next/navigation";
|
||||
|
||||
export const dynamicParams = false;
|
||||
|
||||
export async function generateStaticParams() {
|
||||
// Build params for every (lang × slug) combination based on default language slugs.
|
||||
const slugs = getAllSlugs(DEFAULT_LANG);
|
||||
const params = [];
|
||||
for (const lang of LANG_CODES) {
|
||||
for (const slug of slugs) {
|
||||
params.push({ lang, slug });
|
||||
}
|
||||
}
|
||||
return params;
|
||||
}
|
||||
|
||||
export default async function DocPage({ params }) {
|
||||
const { lang, slug } = await params;
|
||||
if (!isValidLang(lang)) notFound();
|
||||
|
||||
const content = loadContent(lang, slug);
|
||||
if (!content) notFound();
|
||||
|
||||
const headings = extractHeadings(content);
|
||||
|
||||
return (
|
||||
<DocsLayout headings={headings} lang={lang}>
|
||||
<DocsContent content={content} />
|
||||
</DocsLayout>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
import DocsLayout from "@/components/DocsLayout";
|
||||
import DocsContent from "@/components/DocsContent";
|
||||
import { extractHeadings } from "@/utils/markdown";
|
||||
import { loadContent } from "@/lib/content";
|
||||
import { LANG_CODES, isValidLang } from "@/constants/languages";
|
||||
import { notFound } from "next/navigation";
|
||||
|
||||
export const dynamicParams = false;
|
||||
|
||||
export async function generateStaticParams() {
|
||||
return LANG_CODES.map(lang => ({ lang }));
|
||||
}
|
||||
|
||||
export default async function LangHomePage({ params }) {
|
||||
const { lang } = await params;
|
||||
if (!isValidLang(lang)) notFound();
|
||||
|
||||
const content = loadContent(lang, "index") || "# 9Router Documentation\n\nContent coming soon...";
|
||||
const headings = extractHeadings(content);
|
||||
|
||||
return (
|
||||
<DocsLayout headings={headings} lang={lang}>
|
||||
<DocsContent content={content} />
|
||||
</DocsLayout>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,190 @@
|
||||
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');
|
||||
@import "tailwindcss";
|
||||
|
||||
/* Base styles */
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: 'Inter', system-ui, -apple-system, sans-serif;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/* Scrollbar */
|
||||
::-webkit-scrollbar {
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-track {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-thumb {
|
||||
background: #CBD5E1;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-thumb:hover {
|
||||
background: #E68A6E;
|
||||
}
|
||||
|
||||
/* Code highlighting */
|
||||
pre {
|
||||
background: #F1F5F9 !important;
|
||||
border-radius: 8px;
|
||||
padding: 1rem;
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
code {
|
||||
font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
|
||||
font-size: 0.875rem;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
/* Inline code */
|
||||
:not(pre) > code {
|
||||
background: #F1F5F9;
|
||||
color: #E68A6E;
|
||||
padding: 0.125rem 0.375rem;
|
||||
border-radius: 4px;
|
||||
font-size: 0.875em;
|
||||
}
|
||||
|
||||
/* Markdown content styles */
|
||||
.markdown-content h1 {
|
||||
font-size: 2.5rem;
|
||||
font-weight: 800;
|
||||
color: #E68A6E;
|
||||
/* margin-top: 2rem; */
|
||||
margin-bottom: 1rem;
|
||||
line-height: 1.2;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.markdown-content h1 svg {
|
||||
width: 2.5rem;
|
||||
height: 2.5rem;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.markdown-content h2 {
|
||||
font-size: 2rem;
|
||||
font-weight: 700;
|
||||
color: #000000;
|
||||
margin-top: 2rem;
|
||||
margin-bottom: 1rem;
|
||||
line-height: 1.3;
|
||||
border-bottom: 1px solid #E5E7EB;
|
||||
padding-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
.markdown-content h3 {
|
||||
font-size: 1.5rem;
|
||||
font-weight: 600;
|
||||
color: #000000;
|
||||
margin-top: 1.5rem;
|
||||
margin-bottom: 0.75rem;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.markdown-content p {
|
||||
font-size: 1.125rem;
|
||||
line-height: 1.75;
|
||||
margin-bottom: 1rem;
|
||||
color: #6B7280;
|
||||
}
|
||||
|
||||
.markdown-content ul,
|
||||
.markdown-content ol {
|
||||
margin-left: 1.5rem;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.markdown-content li {
|
||||
font-size: 1.125rem;
|
||||
line-height: 1.75;
|
||||
margin-bottom: 0.5rem;
|
||||
color: #6B7280;
|
||||
}
|
||||
|
||||
.markdown-content a {
|
||||
color: #E68A6E;
|
||||
text-decoration: underline;
|
||||
transition: opacity 0.2s;
|
||||
}
|
||||
|
||||
.markdown-content a:hover {
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
.markdown-content blockquote {
|
||||
border-left: 4px solid #E68A6E;
|
||||
padding-left: 1rem;
|
||||
margin: 1rem 0;
|
||||
font-style: italic;
|
||||
color: #6B7280;
|
||||
}
|
||||
|
||||
.markdown-content strong {
|
||||
font-weight: 600;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
/* Smooth scroll */
|
||||
html {
|
||||
scroll-behavior: smooth;
|
||||
scroll-padding-top: 5rem; /* Offset for sticky header (64px + padding) */
|
||||
}
|
||||
|
||||
/* Heading anchor offset for sticky header */
|
||||
.markdown-content h1,
|
||||
.markdown-content h2,
|
||||
.markdown-content h3 {
|
||||
scroll-margin-top: 5rem;
|
||||
}
|
||||
|
||||
/* Mobile menu overlay */
|
||||
.mobile-menu-overlay {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
background: rgba(0, 0, 0, 0.5);
|
||||
z-index: 40;
|
||||
animation: fadeIn 0.2s ease-out;
|
||||
}
|
||||
|
||||
@keyframes fadeIn {
|
||||
from {
|
||||
opacity: 0;
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
.mobile-menu-drawer {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
width: 280px;
|
||||
background: white;
|
||||
z-index: 50;
|
||||
animation: slideInLeft 0.3s ease-out;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
@keyframes slideInLeft {
|
||||
from {
|
||||
transform: translateX(-100%);
|
||||
}
|
||||
to {
|
||||
transform: translateX(0);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
import { DOCS_CONFIG } from "@/constants/docsConfig";
|
||||
import "./globals.css";
|
||||
|
||||
export const metadata = {
|
||||
title: DOCS_CONFIG.title,
|
||||
description: DOCS_CONFIG.description,
|
||||
};
|
||||
|
||||
export default function RootLayout({ children }) {
|
||||
return (
|
||||
<html lang="en">
|
||||
<head>
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossOrigin="anonymous" />
|
||||
</head>
|
||||
<body className="bg-[#FCFBF9] text-[#6B7280]">
|
||||
{children}
|
||||
</body>
|
||||
</html>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
import { DEFAULT_LANG } from "@/constants/languages";
|
||||
|
||||
// Static-friendly redirect to default language (meta refresh + client script)
|
||||
export const metadata = {
|
||||
title: "Redirecting...",
|
||||
other: {
|
||||
"http-equiv:refresh": `0; url=/${DEFAULT_LANG}/`
|
||||
}
|
||||
};
|
||||
|
||||
export default function HomePage() {
|
||||
const target = `/${DEFAULT_LANG}/`;
|
||||
return (
|
||||
<>
|
||||
<script
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: `window.location.replace("${target}");`
|
||||
}}
|
||||
/>
|
||||
<meta httpEquiv="refresh" content={`0; url=${target}`} />
|
||||
<p style={{ padding: "2rem", textAlign: "center" }}>
|
||||
Redirecting to <a href={target}>{target}</a>...
|
||||
</p>
|
||||
</>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user