1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00
metamask-extension/ui/pages/confirmation/components/confirmation-footer/confirmation-footer.js

51 lines
1.2 KiB
JavaScript
Raw Normal View History

2021-02-22 17:20:42 +01:00
import React from 'react';
import PropTypes from 'prop-types';
import classnames from 'classnames';
2021-02-22 17:20:42 +01:00
import Button from '../../../../components/ui/button';
export default function ConfirmationFooter({
onSubmit,
2021-02-22 17:20:42 +01:00
onCancel,
submitText,
2021-02-22 17:20:42 +01:00
cancelText,
2023-03-08 17:33:27 +01:00
loadingText,
2021-02-22 17:20:42 +01:00
alerts,
2023-03-08 17:33:27 +01:00
loading,
submitAlerts,
2021-02-22 17:20:42 +01:00
}) {
return (
<div className="confirmation-footer">
{alerts}
2023-03-08 17:33:27 +01:00
{submitAlerts}
2021-02-22 17:20:42 +01:00
<div className="confirmation-footer__actions">
{onCancel ? (
<Button type="secondary" onClick={onCancel}>
{cancelText}
</Button>
) : null}
<Button
2023-03-08 17:33:27 +01:00
disabled={Boolean(loading)}
type="primary"
onClick={onSubmit}
className={classnames({
centered: !onCancel,
})}
>
2023-03-08 17:33:27 +01:00
{loading ? loadingText : submitText}
2021-02-22 17:20:42 +01:00
</Button>
</div>
</div>
);
}
ConfirmationFooter.propTypes = {
alerts: PropTypes.node,
onCancel: PropTypes.func,
cancelText: PropTypes.string,
onSubmit: PropTypes.func.isRequired,
submitText: PropTypes.string.isRequired,
2023-03-08 17:33:27 +01:00
loadingText: PropTypes.string,
loading: PropTypes.bool,
submitAlerts: PropTypes.node,
2021-02-22 17:20:42 +01:00
};