mirror of
https://github.com/zuiidea/antd-admin
synced 2026-11-27 08:14:06 +00:00
header
This commit is contained in:
@@ -5,12 +5,12 @@ import styles from './main.less'
|
||||
|
||||
const SubMenu = Menu.SubMenu
|
||||
|
||||
function Header({ location, user, logout, switchSider }) {
|
||||
function Header({ user, logout, switchSider, siderFold }) {
|
||||
let handleClickMenu = e => e.key === 'logout' && logout()
|
||||
return (
|
||||
<div className={styles.header}>
|
||||
<div className={styles.siderbutton} onClick={switchSider}>
|
||||
<Icon type="menu-fold" />
|
||||
<Icon type={siderFold?"menu-unfold":"menu-fold"} />
|
||||
</div>
|
||||
<Menu className="header-menu" mode="horizontal" onClick={handleClickMenu}>
|
||||
<SubMenu style={{ float: 'right' }}
|
||||
@@ -25,8 +25,4 @@ function Header({ location, user, logout, switchSider }) {
|
||||
)
|
||||
}
|
||||
|
||||
Header.propTypes = {
|
||||
location: PropTypes.object,
|
||||
}
|
||||
|
||||
export default Header
|
||||
|
||||
@@ -79,6 +79,24 @@
|
||||
transition: @transition-ease-in-out;
|
||||
}
|
||||
}
|
||||
.switchtheme{
|
||||
width: 100%;
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
height: 42px;
|
||||
background-color: #494949;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 0 16px 0 24px;
|
||||
:global{
|
||||
.anticon{
|
||||
min-width: 14px;
|
||||
margin-right: 8px;
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.header {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React, { PropTypes } from 'react'
|
||||
import { Menu, Icon } from 'antd'
|
||||
import { Menu, Icon, Switch } from 'antd'
|
||||
import { Link } from 'dva/router'
|
||||
import styles from './main.less'
|
||||
import { config, menu } from '../../utils'
|
||||
@@ -28,7 +28,7 @@ const getMenus = function (menuArray,siderFold,parentPath) {
|
||||
})
|
||||
}
|
||||
|
||||
function Sider({ siderFold,darkTheme }) {
|
||||
function Sider({ siderFold,darkTheme,changeTheme }) {
|
||||
return (
|
||||
<div>
|
||||
<div className={styles.logo}>
|
||||
@@ -41,13 +41,12 @@ function Sider({ siderFold,darkTheme }) {
|
||||
defaultSelectedKeys={['dashboard']}>
|
||||
{getMenus(menu,siderFold)}
|
||||
</Menu>
|
||||
{!siderFold?<div className={styles.switchtheme}>
|
||||
<span><Icon type="bulb" />切换主题</span>
|
||||
<Switch onChange={changeTheme} defaultChecked={true} checkedChildren="黑" unCheckedChildren="白" />
|
||||
</div>:''}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
Sider.propTypes = {
|
||||
siderFold: PropTypes.bool,
|
||||
darkTheme: PropTypes.bool
|
||||
}
|
||||
|
||||
export default Sider
|
||||
|
||||
Reference in New Issue
Block a user