11import { 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' ;
44import cls from 'classnames' ;
55import Link from 'next/link' ;
66import { default as Router , useRouter } from 'next/router' ;
7- import React , { useContext , useEffect , useState } from 'react' ;
7+ import React , { useContext , useEffect } from 'react' ;
88
99import { UserInfo } from '@/components/UserInfo' ;
1010import { GlobalContext } from '@/context/global' ;
11- import { useSetting } from '@/hooks/useSetting' ;
1211
1312import style from './index.module.scss' ;
1413import { findActiveKeys , findActiveMenu , menus } from './menus' ;
@@ -18,12 +17,12 @@ const { Sider, Content, Footer } = Layout;
1817const { SubMenu } = Menu ;
1918
2019export 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