1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-25 11:28:51 +01:00
metamask-extension/ui/pages/send/send-content/send-row-wrapper/send-row-error-message/send-row-error-message.component.js

31 lines
669 B
JavaScript
Raw Normal View History

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,
};
2018-04-07 00:29:51 +02:00
static contextTypes = {
t: PropTypes.func,
};
2020-11-03 00:41:28 +01:00
render() {
const { errors, errorType } = this.props;
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>
) : null;
2018-04-07 00:29:51 +02:00
}
}