You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
635 B
31 lines
635 B
7 years ago
|
import React from 'react'
|
||
|
import PropTypes from 'prop-types'
|
||
|
|
||
6 years ago
|
const ErrorMessage = (props, context) => {
|
||
6 years ago
|
const { errorMessage, errorKey } = props
|
||
|
const error = errorKey ? context.t(errorKey) : errorMessage
|
||
|
|
||
7 years ago
|
return (
|
||
6 years ago
|
<div className="error-message">
|
||
7 years ago
|
<img
|
||
|
src="/images/alert-red.svg"
|
||
6 years ago
|
className="error-message__icon"
|
||
7 years ago
|
/>
|
||
6 years ago
|
<div className="error-message__text">
|
||
6 years ago
|
{ `ALERT: ${error}` }
|
||
|
</div>
|
||
7 years ago
|
</div>
|
||
|
)
|
||
|
}
|
||
|
|
||
6 years ago
|
ErrorMessage.propTypes = {
|
||
6 years ago
|
errorMessage: PropTypes.string,
|
||
|
errorKey: PropTypes.string,
|
||
|
}
|
||
|
|
||
6 years ago
|
ErrorMessage.contextTypes = {
|
||
6 years ago
|
t: PropTypes.func,
|
||
7 years ago
|
}
|
||
|
|
||
6 years ago
|
export default ErrorMessage
|