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. 20
      app/components/GlobalError/GlobalError.js

20
app/components/GlobalError/GlobalError.js

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

Loading…
Cancel
Save