From 189c5882c30dd8388f3a581dc010c3e3cd18eecf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=B8=85?= Date: Fri, 25 Jan 2019 17:21:16 +0800 Subject: [PATCH] remove PureComponent (#3470) * remove PureComponent * fix typo --- src/components/SiderMenu/SiderMenu.js | 2 +- src/components/SiderMenu/index.less | 4 +- src/layouts/BasicLayout.js | 2 +- src/layouts/Header.js | 4 +- src/layouts/UserLayout.js | 54 ++++++++++----------------- 5 files changed, 25 insertions(+), 41 deletions(-) diff --git a/src/components/SiderMenu/SiderMenu.js b/src/components/SiderMenu/SiderMenu.js index e1b49d00..2522b4f0 100644 --- a/src/components/SiderMenu/SiderMenu.js +++ b/src/components/SiderMenu/SiderMenu.js @@ -51,7 +51,7 @@ export default class SiderMenu extends PureComponent { const defaultProps = collapsed ? {} : { openKeys }; const siderClassName = classNames(styles.sider, { - [styles.fixSiderbar]: fixSiderbar, + [styles.fixSiderBar]: fixSiderbar, [styles.light]: theme === 'light', }); return ( diff --git a/src/components/SiderMenu/index.less b/src/components/SiderMenu/index.less index 9ae37db1..d801b4bd 100644 --- a/src/components/SiderMenu/index.less +++ b/src/components/SiderMenu/index.less @@ -25,13 +25,13 @@ font-weight: 600; } } - .sider { min-height: 100vh; box-shadow: 2px 0 6px rgba(0, 21, 41, 0.35); position: relative; z-index: 10; - &.fixSiderbar { + &.fixSiderBar { + box-shadow: 2px 0 8px 0 rgba(29, 35, 41, 0.05); position: fixed; top: 0; left: 0; diff --git a/src/layouts/BasicLayout.js b/src/layouts/BasicLayout.js index bd7e6eb9..4e9c2e52 100644 --- a/src/layouts/BasicLayout.js +++ b/src/layouts/BasicLayout.js @@ -51,7 +51,7 @@ const query = { }, }; -class BasicLayout extends React.PureComponent { +class BasicLayout extends React.Component { constructor(props) { super(props); this.getPageTitle = memoizeOne(this.getPageTitle); diff --git a/src/layouts/Header.js b/src/layouts/Header.js index 3c22510d..0059ee7e 100644 --- a/src/layouts/Header.js +++ b/src/layouts/Header.js @@ -1,4 +1,4 @@ -import React, { PureComponent } from 'react'; +import React, { Component } from 'react'; import { formatMessage } from 'umi/locale'; import { Layout, message } from 'antd'; import Animate from 'rc-animate'; @@ -10,7 +10,7 @@ import styles from './Header.less'; const { Header } = Layout; -class HeaderView extends PureComponent { +class HeaderView extends Component { state = { visible: true, }; diff --git a/src/layouts/UserLayout.js b/src/layouts/UserLayout.js index 16b70ac7..112c61c0 100644 --- a/src/layouts/UserLayout.js +++ b/src/layouts/UserLayout.js @@ -31,42 +31,26 @@ const copyright = ( ); -class UserLayout extends React.PureComponent { - // @TODO title - // getPageTitle() { - // const { routerData, location } = this.props; - // const { pathname } = location; - // let title = 'Ant Design Pro'; - // if (routerData[pathname] && routerData[pathname].name) { - // title = `${routerData[pathname].name} - Ant Design Pro`; - // } - // return title; - // } - - render() { - const { children } = this.props; - return ( - // @TODO -
-
- -
-
-
-
- - logo - Ant Design - -
-
Ant Design 是西湖区最具影响力的 Web 设计规范
-
- {children} +const UserLayout = ({ children }) => ( + // @TODO +
+
+ +
+
+
+
+ + logo + Ant Design +
- +
Ant Design 是西湖区最具影响力的 Web 设计规范
- ); - } -} + {children} +
+ +
+); export default UserLayout; -- GitLab