48 lines
1.4 KiB
JavaScript
48 lines
1.4 KiB
JavaScript
import React, { PureComponent } from 'react';
|
|
import { Icon } from 'antd';
|
|
import Link from 'umi/link';
|
|
import Debounce from 'lodash-decorators/debounce';
|
|
import styles from './index.less';
|
|
import RightContent from './RightContent';
|
|
import DropdownSelect from './DropdownSelect'
|
|
|
|
export default class GlobalHeader extends PureComponent {
|
|
componentWillUnmount() {
|
|
this.triggerResizeEvent.cancel();
|
|
}
|
|
/* eslint-disable*/
|
|
@Debounce(600)
|
|
triggerResizeEvent() {
|
|
// eslint-disable-line
|
|
const event = document.createEvent('HTMLEvents');
|
|
event.initEvent('resize', true, false);
|
|
window.dispatchEvent(event);
|
|
}
|
|
toggle = () => {
|
|
const { collapsed, onCollapse } = this.props;
|
|
onCollapse(!collapsed);
|
|
this.triggerResizeEvent();
|
|
};
|
|
render() {
|
|
const { collapsed, isMobile, logo } = this.props;
|
|
return (
|
|
<div className={styles.header}>
|
|
{isMobile && (
|
|
<Link to="/" className={styles.logo} key="logo">
|
|
<img src={logo} alt="logo" width="32" />
|
|
</Link>
|
|
)}
|
|
<Icon
|
|
className={styles.trigger}
|
|
type={collapsed ? 'menu-unfold' : 'menu-fold'}
|
|
onClick={this.toggle}
|
|
/>
|
|
<DropdownSelect defaultValue="Select cluster"
|
|
onChange={(item)=>{}}
|
|
data={['cluster1', 'cluster2','cluster3', 'cluster4','cluster5', 'cluster6']}/>
|
|
<RightContent {...this.props} />
|
|
</div>
|
|
);
|
|
}
|
|
}
|