import React, { PureComponent } from 'react'; import Link from 'umi/link'; import RightContent from '../GlobalHeader/RightContent'; import BaseMenu from '../SiderMenu/BaseMenu'; import { getFlatMenuKeys } from '../SiderMenu/SiderMenuUtils'; import styles from './index.less'; export default class TopNavHeader extends PureComponent { state = { maxWidth: undefined, }; static getDerivedStateFromProps(props) { return { maxWidth: (props.contentWidth === 'Fixed' ? 1200 : window.innerWidth) - 280 - 165 - 40, }; } render() { const { theme, contentWidth, menuData, logo } = this.props; const { maxWidth } = this.state; const flatMenuKeys = getFlatMenuKeys(menuData); return (