Skip to content

Commit

Permalink
[Icon Builder] Use FSC, remove pure(), add muiName
Browse files Browse the repository at this point in the history
  • Loading branch information
mbrookes committed May 7, 2016
1 parent bbef1c3 commit f71b5c9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 18 deletions.
26 changes: 10 additions & 16 deletions packages/icon-builder/tpl/SvgIcon.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
import React, {Component} from 'react';
import shallowEqual from 'recompose/shallowEqual';
import SvgIcon from '../../SvgIcon';
import React from 'react';
import SvgIcon from '{{{ muiRequireStmt }}}';

export default class {{className}} extends Component {
static muiName = 'SvgIcon';
let {{className}} = (props) => (
<SvgIcon {...props}>
{{{paths}}}
</SvgIcon>
);

shouldComponentUpdate (nextProps) {
return !shallowEqual(this.props, nextProps)
}
{{className}}.displayName = '{{className}}';
{{className}}.muiName = 'SvgIcon';

render() {
return (
<SvgIcon {...this.props}>
{{{paths}}}
</SvgIcon>
);
}
}
export default {{className}};
4 changes: 2 additions & 2 deletions src/SvgIcon/SvgIcon.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ class SvgIcon extends Component {
hovered: false,
};

shouldComponentUpdate = (nextProps) => {
return !shallowEqual(this.props, nextProps);
shouldComponentUpdate = (nextProps, nextState) => {
return !shallowEqual(this.props, nextProps) || !shallowEqual(this.state, nextState);
};

handleMouseLeave = (event) => {
Expand Down

0 comments on commit f71b5c9

Please sign in to comment.