1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-02 06:07:06 +01:00
metamask-extension/ui/components/app/transaction-activity-log/transaction-activity-log-icon/transaction-activity-log-icon.component.js

52 lines
1.6 KiB
JavaScript
Raw Normal View History

import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import classnames from 'classnames';
2018-12-09 21:48:06 +01:00
import {
TRANSACTION_CREATED_EVENT,
TRANSACTION_SUBMITTED_EVENT,
TRANSACTION_RESUBMITTED_EVENT,
TRANSACTION_CONFIRMED_EVENT,
TRANSACTION_DROPPED_EVENT,
TRANSACTION_ERRORED_EVENT,
TRANSACTION_CANCEL_ATTEMPTED_EVENT,
TRANSACTION_CANCEL_SUCCESS_EVENT,
} from '../transaction-activity-log.constants';
import { Icon, IconName, IconSize } from '../../../component-library';
import { Color } from '../../../../helpers/constants/design-system';
2018-12-09 21:48:06 +01:00
export const ACTIVITY_ICONS = {
[TRANSACTION_CREATED_EVENT]: IconName.Add,
[TRANSACTION_SUBMITTED_EVENT]: IconName.ArrowUp,
[TRANSACTION_RESUBMITTED_EVENT]: IconName.ProgrammingArrows,
[TRANSACTION_CONFIRMED_EVENT]: IconName.Check,
[TRANSACTION_DROPPED_EVENT]: IconName.Close,
[TRANSACTION_ERRORED_EVENT]: IconName.Danger,
[TRANSACTION_CANCEL_ATTEMPTED_EVENT]: IconName.Close,
[TRANSACTION_CANCEL_SUCCESS_EVENT]: IconName.Close,
};
2018-12-09 21:48:06 +01:00
export default class TransactionActivityLogIcon extends PureComponent {
static contextTypes = {
t: PropTypes.func,
};
2018-12-09 21:48:06 +01:00
static propTypes = {
className: PropTypes.string,
eventKey: PropTypes.oneOf(Object.keys(ACTIVITY_ICONS)),
};
2018-12-09 21:48:06 +01:00
2020-11-03 00:41:28 +01:00
render() {
const { className, eventKey } = this.props;
const icon = ACTIVITY_ICONS[eventKey];
2018-12-09 21:48:06 +01:00
return (
<div className={classnames('transaction-activity-log-icon', className)}>
{icon ? (
<Icon name={icon} color={Color.iconDefault} size={IconSize.Sm} />
) : null}
2018-12-09 21:48:06 +01:00
</div>
);
2018-12-09 21:48:06 +01:00
}
}