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
|
@ -17,12 +17,13 @@ const MODAL_COMPONENTS = {
|
|||
|
||||
class ModalRoot extends React.PureComponent {
|
||||
|
||||
constructor (props, context) {
|
||||
super(props, context);
|
||||
this.handleKeyUp = this.handleKeyUp.bind(this);
|
||||
}
|
||||
static propTypes = {
|
||||
type: PropTypes.string,
|
||||
props: PropTypes.object,
|
||||
onClose: PropTypes.func.isRequired
|
||||
};
|
||||
|
||||
handleKeyUp (e) {
|
||||
handleKeyUp = (e) => {
|
||||
if ((e.key === 'Escape' || e.key === 'Esc' || e.keyCode === 27)
|
||||
&& !!this.props.type) {
|
||||
this.props.onClose();
|
||||
|
@ -84,10 +85,4 @@ class ModalRoot extends React.PureComponent {
|
|||
|
||||
}
|
||||
|
||||
ModalRoot.propTypes = {
|
||||
type: PropTypes.string,
|
||||
props: PropTypes.object,
|
||||
onClose: PropTypes.func.isRequired
|
||||
};
|
||||
|
||||
export default ModalRoot;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue