Redux working
This commit is contained in:
@@ -16,11 +16,11 @@ export class SassButton extends React.PureComponent<{
|
||||
onSelect: PropTypes.func.isRequired
|
||||
};
|
||||
|
||||
keyDownAsClick(e: { keyCode: number }) {
|
||||
keyDownAsClick = (e: { keyCode: number }) => {
|
||||
if (e.keyCode === 32 || e.keyCode === 13) {
|
||||
this.props.onSelect();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
return (
|
||||
@@ -29,7 +29,7 @@ export class SassButton extends React.PureComponent<{
|
||||
this.props.normal ? "normalButton" : "alertButton"
|
||||
}
|
||||
onClick={this.props.onSelect}
|
||||
onKeyDown={this.keyDownAsClick.bind(this)}
|
||||
onKeyDown={this.keyDownAsClick}
|
||||
tabIndex="0"
|
||||
role="button"
|
||||
>
|
||||
|
||||
@@ -50,18 +50,18 @@ export class StyledButton extends React.PureComponent<{
|
||||
onSelect: PropTypes.func.isRequired
|
||||
};
|
||||
|
||||
keyDownAsClick(e: { keyCode: number }) {
|
||||
keyDownAsClick = (e: { keyCode: number }) => {
|
||||
if (e.keyCode === 32 || e.keyCode === 13) {
|
||||
this.props.onSelect();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
return (
|
||||
<StyledDiv
|
||||
normal={this.props.normal}
|
||||
onClick={this.props.onSelect}
|
||||
onKeyDown={this.keyDownAsClick.bind(this)}
|
||||
onKeyDown={this.keyDownAsClick}
|
||||
tabIndex="0"
|
||||
role="button"
|
||||
>
|
||||
|
||||
@@ -11,11 +11,6 @@ export const makeResize = Comp => {
|
||||
return class extends React.Component {
|
||||
state = getWindowSize();
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.componentIsResizing = this.componentIsResizing.bind(this);
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
window.addEventListener("resize", this.componentIsResizing);
|
||||
}
|
||||
@@ -24,9 +19,9 @@ export const makeResize = Comp => {
|
||||
window.removeEventListener("resize", this.componentIsResizing);
|
||||
}
|
||||
|
||||
componentIsResizing() {
|
||||
componentIsResizing = () => {
|
||||
this.setState(getWindowSize());
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
return <Comp {...this.props} {...this.state} />;
|
||||
|
||||
Reference in New Issue
Block a user