Skip to content

Commit ef8206e

Browse files
committed
refactor:optimize dark theme style of admin management
1 parent d5379d9 commit ef8206e

File tree

2 files changed

+10
-152
lines changed

2 files changed

+10
-152
lines changed

client/src/layout/AdminLayout/App.tsx

Lines changed: 0 additions & 146 deletions
This file was deleted.

client/src/layout/AdminLayout/index.tsx

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
import { Icon as LegacyIcon } from '@ant-design/compatible';
2-
import { CopyrightOutlined, GithubOutlined, HomeOutlined } from '@ant-design/icons';
3-
import { Breadcrumb, Col, Layout, Menu, Row, theme as antdTheme } from 'antd';
2+
import { GithubOutlined, HomeOutlined } from '@ant-design/icons';
3+
import { Breadcrumb, Col, Layout, Menu, Row } from 'antd';
44
import cls from 'classnames';
55
import Link from 'next/link';
66
import { default as Router, useRouter } from 'next/router';
7-
import React, { useContext, useEffect, useState } from 'react';
7+
import React, { useContext, useEffect } from 'react';
88

99
import { UserInfo } from '@/components/UserInfo';
1010
import { GlobalContext } from '@/context/global';
11-
import { useSetting } from '@/hooks/useSetting';
1211

1312
import style from './index.module.scss';
1413
import { findActiveKeys, findActiveMenu, menus } from './menus';
@@ -18,12 +17,12 @@ const { Sider, Content, Footer } = Layout;
1817
const { SubMenu } = Menu;
1918

2019
export const AdminLayout: React.FC<{ headerAppender?: React.ReactNode }> = ({ headerAppender, children }) => {
21-
const { collapsed, toggleCollapse, theme } = useContext(GlobalContext);
22-
const setting = useSetting();
20+
const { collapsed, toggleCollapse } = useContext(GlobalContext);
2321
const router = useRouter();
2422
const { pathname } = router;
2523
const [activeMenu, breadcrumbs] = findActiveMenu(pathname);
2624
const pathOpenedKeys = findActiveKeys(pathname);
25+
const context = useContext(GlobalContext);
2726

2827
const onOpenChange = (keys) => {
2928
const activeKey = keys[keys.length - 1];
@@ -36,6 +35,11 @@ export const AdminLayout: React.FC<{ headerAppender?: React.ReactNode }> = ({ he
3635
router.push(path);
3736
};
3837

38+
useEffect(() => {
39+
document.body.classList.remove('dark');
40+
context.changeTheme('light');
41+
}, [])
42+
3943
const renderMenuItem = (menu) => (
4044
<Menu.Item
4145
className={style.menu}

0 commit comments

Comments
 (0)