Initial commit

This commit is contained in:
2026-04-02 09:23:57 +08:00
committed by GitHub
commit 8b3ccc6a51
36 changed files with 2887 additions and 0 deletions
+46
View File
@@ -0,0 +1,46 @@
import { ComponentType } from "react"
import { createBrowserRouter } from "react-router-dom"
import ErrorPage from "@/components/error-page"
import HeroLayout from "@/layout/hero-layout"
function lazy<T extends { default: ComponentType<unknown> }>(importer: () => Promise<T>) {
return async () => {
const module = await importer()
return {
Component: module.default,
}
}
}
/**
* Main application router configuration using React Router v6.
* Defines all routes and their corresponding components.
*/
const router = createBrowserRouter(
[
{
path: "/",
element: <HeroLayout />,
errorElement: <ErrorPage />,
children: [
{
index: true,
lazy: lazy(() => import("@/page/home")),
},
{
path: "about",
lazy: lazy(() => import("@/page/about")),
},
{
path: "contact",
lazy: lazy(() => import("@/page/contact")),
},
],
},
],
{
basename: "/",
}
)
export default router