From e97f947177ae86da5cb3ea9d640eb518ff481234 Mon Sep 17 00:00:00 2001 From: abearxiong Date: Sun, 22 Feb 2026 04:27:10 +0800 Subject: [PATCH] feat: refactor BaseHeader to accept main component as prop for improved flexibility --- src/routes/__root.tsx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/routes/__root.tsx b/src/routes/__root.tsx index 14e2da2..8c4a5c8 100644 --- a/src/routes/__root.tsx +++ b/src/routes/__root.tsx @@ -1,5 +1,5 @@ import { LayoutMain } from '@/modules/layout' - +// const LayoutMain = null; import { Link, Outlet, createRootRoute } from '@tanstack/react-router' import { TanStackRouterDevtools } from '@tanstack/react-router-devtools' import { Toaster } from '@/components/ui/sonner' @@ -10,9 +10,10 @@ export const Route = createRootRoute({ component: RootComponent, }) -const BaseHeader = (props: { children?: React.ReactNode }) => { - if (props.children) { - return props.children +const BaseHeader = (props: { main?: React.ComponentType | null }) => { + if (props.main) { + const MainComponent = props.main + return } return ( <> @@ -36,7 +37,7 @@ const BaseHeader = (props: { children?: React.ReactNode }) => { function RootComponent() { return (
- +