Created
November 13, 2018 17:02
-
-
Save gisderdube/c04d5bb50eeba1452c79ba2f564555da to your computer and use it in GitHub Desktop.
This file contains 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
import React, { Component } from 'react' | |
class GlobalError extends Component { | |
render() { | |
if (!this.props.error) return null | |
return ( | |
<div | |
style={{ | |
position: 'fixed', | |
top: 0, | |
left: '50%', | |
transform: 'translateX(-50%)', | |
padding: 10, | |
backgroundColor: '#ffcccc', | |
boxShadow: '0 3px 25px -10px rgba(0,0,0,0.5)', | |
display: 'flex', | |
alignItems: 'center', | |
}} | |
> | |
{this.props.error} | |
| |
<i | |
className="material-icons" | |
style={{ cursor: 'pointer' }} | |
onClick={this.props.resetError} | |
> | |
close | |
</i> | |
</div> | |
) | |
} | |
} | |
export default GlobalError |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment