Browse Source

feature(better-error-message): Autoclose error message after 10 seconds

renovate/lint-staged-8.x
pajasevi 7 years ago
parent
commit
446308d59d
  1. 8
      app/components/GlobalError/GlobalError.js

8
app/components/GlobalError/GlobalError.js

@ -3,7 +3,10 @@ import PropTypes from 'prop-types'
import { MdClose } from 'react-icons/lib/md' import { MdClose } from 'react-icons/lib/md'
import styles from './GlobalError.scss' import styles from './GlobalError.scss'
const GlobalError = ({ error, clearError }) => ( const GlobalError = ({ error, clearError }) => {
setTimeout(clearError, 10000)
return (
<div className={`${styles.container} ${!error && styles.closed}`}> <div className={`${styles.container} ${!error && styles.closed}`}>
<div className={styles.content}> <div className={styles.content}>
<div className={styles.close} onClick={clearError}> <div className={styles.close} onClick={clearError}>
@ -12,7 +15,8 @@ const GlobalError = ({ error, clearError }) => (
<h2>{error}</h2> <h2>{error}</h2>
</div> </div>
</div> </div>
) )
}
GlobalError.propTypes = { GlobalError.propTypes = {

Loading…
Cancel
Save