2018-06-23 08:52:45 +02:00
|
|
|
import React from 'react'
|
|
|
|
import PropTypes from 'prop-types'
|
|
|
|
|
2018-09-16 08:50:17 +02:00
|
|
|
const ErrorMessage = (props, context) => {
|
2018-07-06 20:58:41 +02:00
|
|
|
const { errorMessage, errorKey } = props
|
|
|
|
const error = errorKey ? context.t(errorKey) : errorMessage
|
|
|
|
|
2018-06-23 08:52:45 +02:00
|
|
|
return (
|
2018-09-16 08:50:17 +02:00
|
|
|
<div className="error-message">
|
2018-06-23 08:52:45 +02:00
|
|
|
<img
|
|
|
|
src="/images/alert-red.svg"
|
2018-09-16 08:50:17 +02:00
|
|
|
className="error-message__icon"
|
2018-06-23 08:52:45 +02:00
|
|
|
/>
|
2018-09-16 08:50:17 +02:00
|
|
|
<div className="error-message__text">
|
2018-08-28 21:18:57 +02:00
|
|
|
{ `ALERT: ${error}` }
|
|
|
|
</div>
|
2018-06-23 08:52:45 +02:00
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2018-09-16 08:50:17 +02:00
|
|
|
ErrorMessage.propTypes = {
|
2018-07-06 20:58:41 +02:00
|
|
|
errorMessage: PropTypes.string,
|
|
|
|
errorKey: PropTypes.string,
|
|
|
|
}
|
|
|
|
|
2018-09-16 08:50:17 +02:00
|
|
|
ErrorMessage.contextTypes = {
|
2018-07-06 20:58:41 +02:00
|
|
|
t: PropTypes.func,
|
2018-06-23 08:52:45 +02:00
|
|
|
}
|
|
|
|
|
2018-09-16 08:50:17 +02:00
|
|
|
export default ErrorMessage
|