diff --git a/src/App.jsx b/src/App.jsx index bc66500..79ce196 100755 --- a/src/App.jsx +++ b/src/App.jsx @@ -1,116 +1,10 @@ import React, { useState } from 'react' -import { - DesktopOutlined, - FileOutlined, - PieChartOutlined, - TeamOutlined, - UserOutlined, -} from '@ant-design/icons' -import { useRoutes } from 'react-router-dom' -import routes from './router/index' -import { Breadcrumb, Layout, Menu, theme } from 'antd' -const { Header, Content, Footer, Sider } = Layout +import BaseLayout from '@/layouts/Base' import Login from '@/views/Login' -import { useRootStore } from '@/store' -function getItem(label, key, icon, children) { - return { - key, - icon, - children, - label, - } -} -const items = [ - getItem('Option 1', '1', ), - getItem('Option 2', '2', ), - getItem('User', 'sub1', , [ - getItem('Tom', '3'), - getItem('Bill', '4'), - getItem('Alex', '5'), - ]), - getItem('Team', 'sub2', , [ - getItem('Team 1', '6'), - getItem('Team 2', '8'), - ]), - getItem('Files', '9', ), -] + const App = () => { - const { countStore } = useRootStore() - const { count } = countStore - const [collapsed, setCollapsed] = useState(false) - const [isLogin, setIsLogin] = useState(true) - const { - token: { colorBgContainer }, - } = theme.useToken() - return !isLogin ? ( - - ) : ( - - setCollapsed(value)} - > -
- {count} -
- - - -
- - - User - Bill - -
- {useRoutes(routes)} -
-
-
- Ant Design ©2023 Created by Ant UED -
- - - ) + const [isLogin, setIsLogin] = useState(false) + + return !isLogin ? : } export default App diff --git a/src/layouts/Base.jsx b/src/layouts/Base.jsx new file mode 100644 index 0000000..c7d61cd --- /dev/null +++ b/src/layouts/Base.jsx @@ -0,0 +1,115 @@ +import React, { useState } from 'react' +import { + DesktopOutlined, + FileOutlined, + PieChartOutlined, + TeamOutlined, + UserOutlined, +} from '@ant-design/icons' +import { Breadcrumb, Layout, Menu, theme } from 'antd' +import { useRoutes } from 'react-router-dom' +import routes from '@/router/index' +import { useRootStore } from '@/store' + +const { Header, Content, Footer, Sider } = Layout + +function getItem(label, key, icon, children) { + return { + key, + icon, + children, + label, + } +} +const items = [ + getItem('Option 1', '1', ), + getItem('Option 2', '2', ), + getItem('User', 'sub1', , [ + getItem('Tom', '3'), + getItem('Bill', '4'), + getItem('Alex', '5'), + ]), + getItem('Team', 'sub2', , [ + getItem('Team 1', '6'), + getItem('Team 2', '8'), + ]), + getItem('Files', '9', ), +] +function BaseLayout() { + const { countStore } = useRootStore() + const { count } = countStore + const { + token: { colorBgContainer }, + } = theme.useToken() + const [collapsed, setCollapsed] = useState(false) + return ( + + setCollapsed(value)} + > +
+ {count} +
+ + + +
+ + + User + Bill + +
+ {useRoutes(routes)} +
+
+ + + + ) +} + +export default BaseLayout