perf: sidebar style

This commit is contained in:
Junyan Qin
2025-05-09 17:47:50 +08:00
parent 6935ac33ac
commit a5f3331c24
4 changed files with 53 additions and 28 deletions
@@ -2,14 +2,14 @@
box-sizing: border-box; box-sizing: border-box;
width: 200px; width: 200px;
height: 100vh; height: 100vh;
background-color: #ffffff; background-color: #eee;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: flex-start; align-items: flex-start;
justify-content: space-between; justify-content: space-between;
padding-block: 1rem; padding-block: 1rem;
user-select: none; user-select: none;
box-shadow: 0 0 5px 0 rgba(0, 0, 0, 0.1); /* box-shadow: 0 0 5px 0 rgba(0, 0, 0, 0.1); */
} }
.langbotIconContainer { .langbotIconContainer {
@@ -64,7 +64,6 @@
margin: 0.8rem 0; margin: 0.8rem 0;
padding-left: 2rem; padding-left: 2rem;
font-size: 1rem; font-size: 1rem;
background-color: #fff;
border-radius: 12px; border-radius: 12px;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
@@ -81,7 +80,6 @@
} }
.sidebarUnselected { .sidebarUnselected {
background-color: white;
color: #6C6C6C; color: #6C6C6C;
} }
@@ -94,7 +92,6 @@
.sidebarBottomContainer { .sidebarBottomContainer {
width: 100%; width: 100%;
height: 100px; height: 100px;
background-color: #ffffff;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
@@ -104,7 +101,6 @@
.sidebarBottomChildContainer { .sidebarBottomChildContainer {
width: 100%; width: 100%;
height: 50px; height: 50px;
background-color: aqua;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
} }
@@ -7,7 +7,7 @@
display: flex; display: flex;
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
background-color: #f2f2f2; background-color: #fafafa;
} }
.titleText { .titleText {
+18 -4
View File
@@ -4,14 +4,28 @@
height: 100vh; height: 100vh;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
background-color: #eee;
} }
/* 主内容区域 */ /* 主内容区域 */
.main { .main {
background-color: #f2f2f2; background-color: #fafafa;
overflow: auto; flex: 1;
width: 100%; display: flex;
height: 100%; flex-direction: column;
/* height: 100vh; */
width: calc(100% - 1.2rem);
height: calc(100% - 1.2rem);
overflow: hidden;
border-radius: 1.5rem 0 0 1.5rem;
margin-left: 0.6rem;
margin-top: 0.6rem;
}
.mainContent {
padding: 1.5rem; padding: 1.5rem;
padding-left: 2rem; padding-left: 2rem;
flex: 1;
overflow-y: auto;
background-color: #fafafa;
} }
+32 -17
View File
@@ -6,9 +6,9 @@ import HomeSidebar from '@/app/home/components/home-sidebar/HomeSidebar';
import HomeTitleBar from '@/app/home/components/home-titlebar/HomeTitleBar'; import HomeTitleBar from '@/app/home/components/home-titlebar/HomeTitleBar';
import React, { useState } from 'react'; import React, { useState } from 'react';
import { SidebarChildVO } from '@/app/home/components/home-sidebar/HomeSidebarChild'; import { SidebarChildVO } from '@/app/home/components/home-sidebar/HomeSidebarChild';
import { Layout } from 'antd'; // import { Layout } from 'antd';
const { Sider, Content } = Layout; // const { Sider, Content } = Layout;
export default function HomeLayout({ export default function HomeLayout({
children, children,
@@ -21,24 +21,39 @@ export default function HomeLayout({
}; };
return ( return (
<Layout className={styles.homeLayoutContainer}> // <Layout className={styles.homeLayoutContainer}>
{/* homeLayoutContainer 是整个容器的入口,使用 flex 的左右布局 */} // {/* homeLayoutContainer 是整个容器的入口,使用 flex 的左右布局 */}
<Sider className="left"> // <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>
<div className={styles.homeLayoutContainer}>
<aside className={styles.sidebar}>
<HomeSidebar onSelectedChangeAction={onSelectedChangeAction} /> <HomeSidebar onSelectedChangeAction={onSelectedChangeAction} />
{/* HomeSidebar 为侧边栏 */} </aside>
</Sider>
<div className={styles.main}>
<Layout className="right">
{/* right 为内容显示区域,right使用 flex 上下布局,right 使用 flex 布局吃掉剩余部分 */}
<HomeTitleBar title={title} /> <HomeTitleBar title={title} />
<Content className={styles.main}> <main className={styles.mainContent}>
{/* mainContent 为主页面 */}
{children} {children}
</Content> </main>
</Layout> </div>
</Layout>
</div>
); );
} }