feat(NavCommon): 添加关闭按钮并调整抽屉样式

- 在抽屉头部添加关闭按钮,提升用户体验
- 重构抽屉样式结构,分离头部和内容样式
- 调整图标大小和布局,保持视觉一致性
This commit is contained in:
超级老白兔
2025-09-12 18:05:18 +08:00
parent f2fb543f93
commit ca1eefb906
2 changed files with 54 additions and 44 deletions

View File

@@ -177,6 +177,54 @@
:global(.ant-drawer-body) {
padding: 0;
}
// 抽屉头部
.drawerHeader {
padding: 20px;
background: #fff;
border-bottom: none;
display: flex;
justify-content: space-between;
align-items: center;
.logoSection {
display: flex;
align-items: center;
gap: 12px;
.logoIcon {
width: 40px;
height: 40px;
background: linear-gradient(135deg, #3b81f6 0%, #9035ea 100%);
border-radius: 12px;
display: flex;
align-items: center;
justify-content: center;
font-size: 24px;
color: white;
}
.logoText {
display: flex;
flex-direction: column;
.appName {
font-size: 16px;
font-weight: 600;
color: #333;
margin: 0;
}
.appDesc {
font-size: 12px;
color: #999;
margin: 2px 0 0 0;
}
}
}
.anticon {
cursor: pointer;
}
}
// 抽屉内容容器
.drawerContent {
@@ -185,49 +233,6 @@
flex-direction: column;
background: #f8f9fa;
// 抽屉头部
.drawerHeader {
padding: 20px;
background: #fff;
border-bottom: none;
.logoSection {
display: flex;
align-items: center;
gap: 12px;
.logoIcon {
width: 48px;
height: 48px;
background: linear-gradient(135deg, #3b81f6 0%, #9035ea 100%);
border-radius: 12px;
display: flex;
align-items: center;
justify-content: center;
font-size: 24px;
color: white;
}
.logoText {
display: flex;
flex-direction: column;
.appName {
font-size: 18px;
font-weight: 600;
color: #333;
margin: 0;
}
.appDesc {
font-size: 12px;
color: #999;
margin: 2px 0 0 0;
}
}
}
}
// 抽屉主体内容
.drawerBody {
flex: 1;

View File

@@ -4,8 +4,9 @@ import {
MenuOutlined,
UserOutlined,
BellOutlined,
UserSwitchOutlined,
CloseOutlined,
LogoutOutlined,
UserSwitchOutlined,
} from "@ant-design/icons";
import { useUserStore } from "@/store/module/user";
@@ -104,6 +105,9 @@ const NavCommon: React.FC<NavCommonProps> = ({
</div>
</div>
</div>
<span className={styles.anticon} onClick={handleDrawerClose}>
<CloseOutlined />
</span>
</div>
<div className={styles.drawerBody}>
<div className={styles.menuSection}>
@@ -194,6 +198,7 @@ const NavCommon: React.FC<NavCommonProps> = ({
open={drawerVisible}
width={300}
className={styles.drawer}
closable={false}
>
{defaultDrawerContent}
</Drawer>