mirror of
https://github.com/wu736139669/hapi.git
synced 2026-08-05 06:24:37 +00:00
- Set VitePress base to '/docs/' for serving documentation at /docs/ route - Update favicon path in head config to '/docs/favicon.ico' - Add build:site script to build website and docs, then merge outputs
45 lines
1.2 KiB
TypeScript
45 lines
1.2 KiB
TypeScript
import { Toaster } from "@/components/ui/sonner";
|
|
import { TooltipProvider } from "@/components/ui/tooltip";
|
|
import NotFound from "@/pages/NotFound";
|
|
import { Route, Switch } from "wouter";
|
|
import ErrorBoundary from "./components/ErrorBoundary";
|
|
import { ThemeProvider } from "./contexts/ThemeContext";
|
|
import Home from "./pages/Home";
|
|
|
|
|
|
|
|
function Router() {
|
|
return (
|
|
<Switch>
|
|
<Route path={"/"} component={Home} />
|
|
|
|
<Route path={"/404"} component={NotFound} />
|
|
{/* Final fallback route */}
|
|
<Route component={NotFound} />
|
|
</Switch>
|
|
);
|
|
}
|
|
|
|
// NOTE: About Theme
|
|
// - First choose a default theme according to your design style (dark or light bg), than change color palette in index.css
|
|
// to keep consistent foreground/background color across components
|
|
// - If you want to make theme switchable, pass `switchable` ThemeProvider and use `useTheme` hook
|
|
|
|
function App() {
|
|
return (
|
|
<ErrorBoundary>
|
|
<ThemeProvider
|
|
defaultTheme="system"
|
|
storageKey="hapi-theme"
|
|
>
|
|
<TooltipProvider>
|
|
<Toaster />
|
|
<Router />
|
|
</TooltipProvider>
|
|
</ThemeProvider>
|
|
</ErrorBoundary>
|
|
);
|
|
}
|
|
|
|
export default App;
|