2021-02-04 19:15:23 +01:00
|
|
|
import React, { Component } from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import classnames from 'classnames';
|
2018-04-26 18:38:38 +02:00
|
|
|
|
2018-04-07 00:29:51 +02:00
|
|
|
export default class SendRowErrorMessage extends Component {
|
|
|
|
static propTypes = {
|
|
|
|
errors: PropTypes.object,
|
|
|
|
errorType: PropTypes.string,
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2018-04-07 00:29:51 +02:00
|
|
|
|
2018-07-02 04:09:28 +02:00
|
|
|
static contextTypes = {
|
|
|
|
t: PropTypes.func,
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2018-07-02 04:09:28 +02:00
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
render() {
|
2021-02-04 19:15:23 +01:00
|
|
|
const { errors, errorType } = this.props;
|
2018-04-27 21:03:00 +02:00
|
|
|
|
2021-02-04 19:15:23 +01:00
|
|
|
const errorMessage = errors[errorType];
|
2018-04-07 00:29:51 +02:00
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
return errorMessage ? (
|
|
|
|
<div
|
|
|
|
className={classnames('send-v2__error', {
|
|
|
|
'send-v2__error-amount': errorType === 'amount',
|
|
|
|
})}
|
|
|
|
>
|
|
|
|
{this.context.t(errorMessage)}
|
|
|
|
</div>
|
2021-02-04 19:15:23 +01:00
|
|
|
) : null;
|
2018-04-07 00:29:51 +02:00
|
|
|
}
|
|
|
|
}
|