Files
LangBot/web/src/app/home/layout.tsx
2025-04-30 17:36:46 +08:00

45 lines
1.3 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
'use client';
import '@ant-design/v5-patch-for-react-19';
import styles from './layout.module.css';
import HomeSidebar from '@/app/home/components/home-sidebar/HomeSidebar';
import HomeTitleBar from '@/app/home/components/home-titlebar/HomeTitleBar';
import React, { useState } from 'react';
import { SidebarChildVO } from '@/app/home/components/home-sidebar/HomeSidebarChild';
import { Layout } from 'antd';
const { Sider, Content } = Layout;
export default function HomeLayout({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
const [title, setTitle] = useState<string>('');
const onSelectedChangeAction = (child: SidebarChildVO) => {
setTitle(child.name);
};
return (
<Layout className={styles.homeLayoutContainer}>
{/* homeLayoutContainer 是整个容器的入口,使用 flex 的左右布局 */}
<Sider className="left">
<HomeSidebar onSelectedChangeAction={onSelectedChangeAction} />
{/* HomeSidebar 为侧边栏 */}
</Sider>
<Layout className="right">
{/* right 为内容显示区域right使用 flex 上下布局right 使用 flex 布局吃掉剩余部分 */}
<HomeTitleBar title={title} />
<Content className={styles.main}>
{/* mainContent 为主页面 */}
{children}
</Content>
</Layout>
</Layout>
);
}