mirror of
https://github.com/hanzo-docs/docs.git
synced 2026-10-27 09:19:53 +00:00
Thirteen shipped apps and every scaffold in packages/create-app pulled their face from Google at request time — Inter through next/font/google in the examples and the four Next templates, Geist and Geist_Mono in the apps, and in the seven react-router roots a bare <link> to fonts.googleapis.com. That last one never even applied what it fetched: nothing in those trees set a family, so the browser downloaded Inter, spent two preconnects on it, and rendered system-ui. So `create-app` handed a customer a new docs site whose first act was a third-party font request for a face that is not ours. The apps read the family back through --font-sans and --font-mono, which are next/font's handles rather than names of anything, so those follow the binding over to --font-zen-sans and --font-zen-mono. Eight of them had only ever bound the mono and were leaning on Tailwind's default for the text face; they now name both, or swapping the binding would have dropped the body copy to system-ui without a word. Zen and ZenMono are built faces, not constructors — subsetting, display: swap and fallback metrics are already in them — so the call and its options go away.
63 lines
1.6 KiB
TypeScript
63 lines
1.6 KiB
TypeScript
import {
|
|
isRouteErrorResponse,
|
|
Links,
|
|
Meta,
|
|
Outlet,
|
|
Scripts,
|
|
ScrollRestoration,
|
|
} from 'react-router';
|
|
import { RootProvider } from '@hanzo/docs/ui/provider/react-router';
|
|
import type { Route } from './+types/root';
|
|
import './app.css';
|
|
import SearchDialog from '@/components/search';
|
|
import NotFound from './routes/not-found';
|
|
|
|
export function Layout({ children }: { children: React.ReactNode }) {
|
|
return (
|
|
<html lang="en" suppressHydrationWarning>
|
|
<head>
|
|
<meta charSet="utf-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
<Meta />
|
|
<Links />
|
|
</head>
|
|
<body className="flex flex-col min-h-screen">
|
|
<RootProvider search={{ SearchDialog }}>{children}</RootProvider>
|
|
<ScrollRestoration />
|
|
<Scripts />
|
|
</body>
|
|
</html>
|
|
);
|
|
}
|
|
|
|
export default function App() {
|
|
return <Outlet />;
|
|
}
|
|
|
|
export function ErrorBoundary({ error }: Route.ErrorBoundaryProps) {
|
|
let message = 'Oops!';
|
|
let details = 'An unexpected error occurred.';
|
|
let stack: string | undefined;
|
|
|
|
if (isRouteErrorResponse(error)) {
|
|
if (error.status === 404) return <NotFound />;
|
|
message = 'Error';
|
|
details = error.statusText;
|
|
} else if (import.meta.env.DEV && error && error instanceof Error) {
|
|
details = error.message;
|
|
stack = error.stack;
|
|
}
|
|
|
|
return (
|
|
<main className="pt-16 p-4 w-full max-w-[1400px] mx-auto">
|
|
<h1>{message}</h1>
|
|
<p>{details}</p>
|
|
{stack && (
|
|
<pre className="w-full p-4 overflow-x-auto">
|
|
<code>{stack}</code>
|
|
</pre>
|
|
)}
|
|
</main>
|
|
);
|
|
}
|