24 lines
762 B
TypeScript
24 lines
762 B
TypeScript
|
|
import React from 'react';
|
||
|
|
import { useLocation } from 'react-router-dom';
|
||
|
|
import BottomNav from './BottomNav';
|
||
|
|
|
||
|
|
interface LayoutWrapperProps {
|
||
|
|
children: React.ReactNode;
|
||
|
|
}
|
||
|
|
|
||
|
|
export default function LayoutWrapper({ children }: LayoutWrapperProps) {
|
||
|
|
const location = useLocation();
|
||
|
|
|
||
|
|
// 只在四个主页显示底部导航栏:首页、场景获客、工作台和我的
|
||
|
|
const mainPages = ["/", "/scenarios", "/workspace", "/profile"];
|
||
|
|
const showBottomNav = mainPages.includes(location.pathname);
|
||
|
|
|
||
|
|
return (
|
||
|
|
<div className="mx-auto w-full">
|
||
|
|
<main className="w-full mx-auto bg-white min-h-screen flex flex-col relative lg:max-w-7xl xl:max-w-[1200px]">
|
||
|
|
{children}
|
||
|
|
{showBottomNav && <BottomNav />}
|
||
|
|
</main>
|
||
|
|
</div>
|
||
|
|
);
|
||
|
|
}
|