about summary refs log tree commit diff
path: root/app/assets/javascripts/components/components/avatar.jsx
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/components/components/avatar.jsx')
-rw-r--r--app/assets/javascripts/components/components/avatar.jsx47
1 files changed, 23 insertions, 24 deletions
diff --git a/app/assets/javascripts/components/components/avatar.jsx b/app/assets/javascripts/components/components/avatar.jsx
index 673b1a247..54f96b3a7 100644
--- a/app/assets/javascripts/components/components/avatar.jsx
+++ b/app/assets/javascripts/components/components/avatar.jsx
@@ -1,36 +1,23 @@
-import PureRenderMixin from 'react-addons-pure-render-mixin';
+import PropTypes from 'prop-types';
 
-const Avatar = React.createClass({
+class Avatar extends React.PureComponent {
 
-  propTypes: {
-    src: React.PropTypes.string.isRequired,
-    staticSrc: React.PropTypes.string,
-    size: React.PropTypes.number.isRequired,
-    style: React.PropTypes.object,
-    animate: React.PropTypes.bool
-  },
-
-  getDefaultProps () {
-    return {
-      animate: false
-    };
-  },
-
-  getInitialState () {
-    return {
+  constructor (props, context) {
+    super(props, context);
+    this.state = {
       hovering: false
     };
-  },
-
-  mixins: [PureRenderMixin],
+    this.handleMouseEnter = this.handleMouseEnter.bind(this);
+    this.handleMouseLeave = this.handleMouseLeave.bind(this);
+  }
 
   handleMouseEnter () {
     this.setState({ hovering: true });
-  },
+  }
 
   handleMouseLeave () {
     this.setState({ hovering: false });
-  },
+  }
 
   render () {
     const { src, size, staticSrc, animate } = this.props;
@@ -59,6 +46,18 @@ const Avatar = React.createClass({
     );
   }
 
-});
+}
+
+Avatar.propTypes = {
+  src: PropTypes.string.isRequired,
+  staticSrc: PropTypes.string,
+  size: PropTypes.number.isRequired,
+  style: PropTypes.object,
+  animate: PropTypes.bool
+};
+
+Avatar.defaultProps = {
+  animate: false
+};
 
 export default Avatar;