From 8a2f180c31f00a6865d519dc06d98686bd3794c1 Mon Sep 17 00:00:00 2001 From: afc163 Date: Wed, 5 Sep 2018 22:52:45 +0800 Subject: [PATCH] refactor some code --- src/components/SiderMenu/SliderMenu.js | 15 ++++++++++----- src/components/SiderMenu/index.less | 2 +- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/components/SiderMenu/SliderMenu.js b/src/components/SiderMenu/SliderMenu.js index ccbe5ea6..e457f2f5 100644 --- a/src/components/SiderMenu/SliderMenu.js +++ b/src/components/SiderMenu/SliderMenu.js @@ -1,6 +1,7 @@ import React, { PureComponent } from 'react'; import { Layout } from 'antd'; import pathToRegexp from 'path-to-regexp'; +import classNames from 'classnames'; import Link from 'umi/link'; import styles from './index.less'; import BaseMenu, { getMenuMatches } from './BaseMenu'; @@ -89,6 +90,12 @@ export default class SiderMenu extends PureComponent { const { logo, collapsed, onCollapse, fixSiderbar, theme } = this.props; const { openKeys } = this.state; const defaultProps = collapsed ? {} : { openKeys }; + + const siderClassName = classNames(styles.sider, { + [styles.fixSiderbar]: fixSiderbar, + [styles.light]: theme === 'light', + }); + return ( -