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 { MdClose } from 'react-icons/lib/md'
import styles from './GlobalError.scss' import styles from './GlobalError.scss'
const GlobalError = ({ error, clearError }) => ( const GlobalError = ({ error, clearError }) => {
<div className={`${styles.container} ${!error && styles.closed}`}> setTimeout(clearError, 10000)
<div className={styles.content}>
<div className={styles.close} onClick={clearError}> return (
<MdClose /> <div className={`${styles.container} ${!error && styles.closed}`}>
<div className={styles.content}>
<div className={styles.close} onClick={clearError}>
<MdClose />
</div>
<h2>{error}</h2>
</div> </div>
<h2>{error}</h2>
</div> </div>
</div> )
) }
GlobalError.propTypes = { GlobalError.propTypes = {

Loading…
Cancel
Save