diff options
Diffstat (limited to 'packages/docs/app/root.tsx')
| -rw-r--r-- | packages/docs/app/root.tsx | 49 |
1 files changed, 27 insertions, 22 deletions
diff --git a/packages/docs/app/root.tsx b/packages/docs/app/root.tsx index 9032c80..621175c 100644 --- a/packages/docs/app/root.tsx +++ b/packages/docs/app/root.tsx @@ -1,3 +1,4 @@ +import { RootProvider } from "fumadocs-ui/provider/react-router"; import { isRouteErrorResponse, Link, @@ -7,40 +8,39 @@ import { Scripts, ScrollRestoration, useParams, -} from 'react-router'; -import { RootProvider } from 'fumadocs-ui/provider/react-router'; -import type { Route } from './+types/root'; -import './app.css'; -import { defineI18nUI } from 'fumadocs-ui/i18n'; -import { i18n } from './lib/i18n'; +} from "react-router"; +import type { Route } from "./+types/root"; +import "./app.css"; +import { defineI18nUI } from "fumadocs-ui/i18n"; +import { i18n } from "./lib/i18n"; const { provider } = defineI18nUI(i18n, { translations: { en: { - displayName: 'English', + displayName: "English", }, zh: { - displayName: '中文', - search: '查找文档', + displayName: "中文", + search: "查找文档", }, }, }); export const links: Route.LinksFunction = () => [ - { rel: 'preconnect', href: 'https://fonts.googleapis.com' }, + { rel: "preconnect", href: "https://fonts.googleapis.com" }, { - rel: 'preconnect', - href: 'https://fonts.gstatic.com', - crossOrigin: 'anonymous', + rel: "preconnect", + href: "https://fonts.gstatic.com", + crossOrigin: "anonymous", }, { - rel: 'stylesheet', - href: 'https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap', + rel: "stylesheet", + href: "https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap", }, ]; export function Layout({ children }: { children: React.ReactNode }) { const { lang = i18n.defaultLanguage } = useParams(); - + return ( <html lang={lang} suppressHydrationWarning> <head> @@ -63,14 +63,16 @@ export default function App() { } export function ErrorBoundary({ error }: Route.ErrorBoundaryProps) { - let message = 'Oops!'; - let details = 'An unexpected error occurred.'; + let message = "Oops!"; + let details = "An unexpected error occurred."; let stack: string | undefined; if (isRouteErrorResponse(error)) { - message = error.status === 404 ? '404' : 'Error'; + message = error.status === 404 ? "404" : "Error"; details = - error.status === 404 ? 'The requested page could not be found.' : error.statusText || details; + error.status === 404 + ? "The requested page could not be found." + : error.statusText || details; } else if (import.meta.env.DEV && error && error instanceof Error) { details = error.message; stack = error.stack; @@ -83,7 +85,8 @@ export function ErrorBoundary({ error }: Route.ErrorBoundaryProps) { </h1> <p className="text-2xl font-semibold mb-2">{details}</p> <p className="text-fd-muted-foreground mb-8 max-w-md"> - Sorry, we couldn't find the page you're looking for. It might have been moved or deleted. + Sorry, we couldn't find the page you're looking for. It might have been + moved or deleted. </p> <Link to="/" @@ -93,7 +96,9 @@ export function ErrorBoundary({ error }: Route.ErrorBoundaryProps) { </Link> {stack && ( <div className="mt-12 w-full max-w-2xl text-left"> - <p className="text-xs font-mono text-fd-muted-foreground mb-2 uppercase tracking-widest">Error Stack</p> + <p className="text-xs font-mono text-fd-muted-foreground mb-2 uppercase tracking-widest"> + Error Stack + </p> <pre className="p-4 overflow-x-auto text-sm bg-fd-muted rounded-xl border border-fd-border font-mono whitespace-pre-wrap break-all shadow-inner"> <code>{stack}</code> </pre> |