2021-02-04 19:15:23 +01:00
|
|
|
import React, { useContext } from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import classnames from 'classnames';
|
|
|
|
import { I18nContext } from '../../../contexts/i18n';
|
2020-10-06 20:28:38 +02:00
|
|
|
|
2021-02-04 19:15:23 +01:00
|
|
|
import PageContainerFooter from '../../../components/ui/page-container/page-container-footer';
|
2020-10-06 20:28:38 +02:00
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
export default function SwapsFooter({
|
2020-10-06 20:28:38 +02:00
|
|
|
onCancel,
|
|
|
|
hideCancel,
|
|
|
|
onSubmit,
|
|
|
|
submitText,
|
|
|
|
disabled,
|
|
|
|
showTermsOfService,
|
|
|
|
showTopBorder,
|
2020-12-02 22:27:45 +01:00
|
|
|
className = '',
|
2022-02-18 17:48:38 +01:00
|
|
|
cancelText,
|
2020-10-06 20:28:38 +02:00
|
|
|
}) {
|
2021-02-04 19:15:23 +01:00
|
|
|
const t = useContext(I18nContext);
|
2020-10-06 20:28:38 +02:00
|
|
|
|
|
|
|
return (
|
|
|
|
<div className="swaps-footer">
|
|
|
|
<div
|
2020-12-02 22:27:45 +01:00
|
|
|
className={classnames('swaps-footer__buttons', className, {
|
2020-10-06 20:28:38 +02:00
|
|
|
'swaps-footer__buttons--border': showTopBorder,
|
|
|
|
})}
|
|
|
|
>
|
|
|
|
<PageContainerFooter
|
|
|
|
onCancel={onCancel}
|
|
|
|
hideCancel={hideCancel}
|
2022-02-18 17:48:38 +01:00
|
|
|
cancelText={cancelText || t('back')}
|
2020-10-06 20:28:38 +02:00
|
|
|
onSubmit={onSubmit}
|
|
|
|
submitText={submitText}
|
2020-12-08 17:47:53 +01:00
|
|
|
footerClassName={classnames(
|
|
|
|
'swaps-footer__custom-page-container-footer-class',
|
|
|
|
className,
|
|
|
|
)}
|
2020-11-03 00:41:28 +01:00
|
|
|
footerButtonClassName={classnames(
|
|
|
|
'swaps-footer__custom-page-container-footer-button-class',
|
|
|
|
{
|
2022-07-31 20:26:40 +02:00
|
|
|
'swaps-footer__custom-page-container-footer-button-class--single':
|
|
|
|
hideCancel,
|
2020-11-03 00:41:28 +01:00
|
|
|
},
|
|
|
|
)}
|
2020-10-06 20:28:38 +02:00
|
|
|
disabled={disabled}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
{showTermsOfService && (
|
|
|
|
<div
|
|
|
|
className="swaps-footer__bottom-text"
|
2020-11-03 00:41:28 +01:00
|
|
|
onClick={() =>
|
|
|
|
global.platform.openTab({ url: 'https://metamask.io/terms.html' })
|
|
|
|
}
|
2020-10-06 20:28:38 +02:00
|
|
|
>
|
|
|
|
{t('termsOfService')}
|
|
|
|
</div>
|
|
|
|
)}
|
|
|
|
</div>
|
2021-02-04 19:15:23 +01:00
|
|
|
);
|
2020-10-06 20:28:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
SwapsFooter.propTypes = {
|
|
|
|
onCancel: PropTypes.func,
|
|
|
|
hideCancel: PropTypes.bool,
|
|
|
|
onSubmit: PropTypes.func.isRequired,
|
|
|
|
submitText: PropTypes.string,
|
|
|
|
disabled: PropTypes.bool,
|
|
|
|
showTermsOfService: PropTypes.bool,
|
|
|
|
showTopBorder: PropTypes.bool,
|
2020-12-02 22:27:45 +01:00
|
|
|
className: PropTypes.string,
|
2022-02-18 17:48:38 +01:00
|
|
|
cancelText: PropTypes.string,
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|