Created
November 30, 2015 12:52
-
-
Save namelos/85ecb9d146de597d7253 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export const error = ComposedComponent => | |
| class extends Component { | |
| state = { display: 0 } | |
| toggle = display => | |
| this.setState({ display }) | |
| reset = () => | |
| this.toggle(0) | |
| err = message => { | |
| this.toggle(message) | |
| setTimeout(this.reset, 1000) | |
| } | |
| render = () => <div> | |
| <ComposedComponent { ...this.props } err={ this.err } /> | |
| <div onClick={ this.reset } className="hint-box-wrapper" | |
| style={{ display: this.state.display === 0 ? 'none' : 'block' }} > | |
| <div className="hint-box"> | |
| <div className="hint-box-inner"> | |
| { this.state.display } | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment