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.
This commit is contained in:
parent
44a3584e2d
commit
2991a7cfe6
79 changed files with 838 additions and 1128 deletions
|
@ -32,14 +32,15 @@ const scrollTop = (node) => {
|
|||
|
||||
class Column extends React.PureComponent {
|
||||
|
||||
constructor (props, context) {
|
||||
super(props, context);
|
||||
this.handleHeaderClick = this.handleHeaderClick.bind(this);
|
||||
this.handleWheel = this.handleWheel.bind(this);
|
||||
this.setRef = this.setRef.bind(this);
|
||||
}
|
||||
static propTypes = {
|
||||
heading: PropTypes.string,
|
||||
icon: PropTypes.string,
|
||||
children: PropTypes.node,
|
||||
active: PropTypes.bool,
|
||||
hideHeadingOnMobile: PropTypes.bool
|
||||
};
|
||||
|
||||
handleHeaderClick () {
|
||||
handleHeaderClick = () => {
|
||||
const scrollable = this.node.querySelector('.scrollable');
|
||||
if (!scrollable) {
|
||||
return;
|
||||
|
@ -47,13 +48,13 @@ class Column extends React.PureComponent {
|
|||
this._interruptScrollAnimation = scrollTop(scrollable);
|
||||
}
|
||||
|
||||
handleWheel () {
|
||||
handleWheel = () => {
|
||||
if (typeof this._interruptScrollAnimation !== 'undefined') {
|
||||
this._interruptScrollAnimation();
|
||||
}
|
||||
}
|
||||
|
||||
setRef (c) {
|
||||
setRef = (c) => {
|
||||
this.node = c;
|
||||
}
|
||||
|
||||
|
@ -82,12 +83,4 @@ class Column extends React.PureComponent {
|
|||
|
||||
}
|
||||
|
||||
Column.propTypes = {
|
||||
heading: PropTypes.string,
|
||||
icon: PropTypes.string,
|
||||
children: PropTypes.node,
|
||||
active: PropTypes.bool,
|
||||
hideHeadingOnMobile: PropTypes.bool
|
||||
};
|
||||
|
||||
export default Column;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue