about summary refs log tree commit diff
path: root/app/javascript/mastodon/components/button.js
diff options
context:
space:
mode:
authorYamagishi Kazutoshi <ykzts@desire.sh>2017-05-12 21:44:10 +0900
committerEugen Rochko <eugen@zeonfederated.com>2017-05-12 14:44:10 +0200
commit2991a7cfe685ca9b42230b7030b9e7d0ece94c88 (patch)
tree72da0f02bc6279aeab1e641fb7d51527efcb9066 /app/javascript/mastodon/components/button.js
parent44a3584e2d54488393e6f50e482ed61d2765e312 (diff)
Use ES Class Fields & Static Properties (#3008)
Use ES Class Fields & Static Properties (currently stage 2) for improve class outlook.

Added babel-plugin-transform-class-properties as a Babel plugin.
Diffstat (limited to 'app/javascript/mastodon/components/button.js')
-rw-r--r--app/javascript/mastodon/components/button.js37
1 files changed, 16 insertions, 21 deletions
diff --git a/app/javascript/mastodon/components/button.js b/app/javascript/mastodon/components/button.js
index 1063e0289..40a17f92e 100644
--- a/app/javascript/mastodon/components/button.js
+++ b/app/javascript/mastodon/components/button.js
@@ -3,12 +3,22 @@ import PropTypes from 'prop-types';
 
 class Button extends React.PureComponent {
 
-  constructor (props, context) {
-    super(props, context);
-    this.handleClick = this.handleClick.bind(this);
-  }
-
-  handleClick (e) {
+  static propTypes = {
+    text: PropTypes.node,
+    onClick: PropTypes.func,
+    disabled: PropTypes.bool,
+    block: PropTypes.bool,
+    secondary: PropTypes.bool,
+    size: PropTypes.number,
+    style: PropTypes.object,
+    children: PropTypes.node
+  };
+
+  static defaultProps = {
+    size: 36
+  };
+
+  handleClick = (e) => {
     if (!this.props.disabled) {
       this.props.onClick();
     }
@@ -32,19 +42,4 @@ class Button extends React.PureComponent {
 
 }
 
-Button.propTypes = {
-  text: PropTypes.node,
-  onClick: PropTypes.func,
-  disabled: PropTypes.bool,
-  block: PropTypes.bool,
-  secondary: PropTypes.bool,
-  size: PropTypes.number,
-  style: PropTypes.object,
-  children: PropTypes.node
-};
-
-Button.defaultProps = {
-  size: 36
-};
-
 export default Button;