mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
7c2f7671b0
* ButtonSecondary to TS * updating components and addressing errors * lint and snapshot updates * using Boolean conversion for className * removing ValidButtonTag type * fix text color when link --------- Co-authored-by: garrettbear <gwhisten@gmail.com>
61 lines
1.5 KiB
JavaScript
61 lines
1.5 KiB
JavaScript
import PropTypes from 'prop-types';
|
|
import React from 'react';
|
|
import { useDispatch } from 'react-redux';
|
|
import {
|
|
ButtonPrimary,
|
|
ButtonSecondary,
|
|
Box,
|
|
ButtonSecondarySize,
|
|
} from '../../component-library';
|
|
import { Display } from '../../../helpers/constants/design-system';
|
|
import { useI18nContext } from '../../../hooks/useI18nContext';
|
|
import * as actions from '../../../store/actions';
|
|
|
|
BottomButtons.propTypes = {
|
|
importAccountFunc: PropTypes.func.isRequired,
|
|
isPrimaryDisabled: PropTypes.bool.isRequired,
|
|
onActionComplete: PropTypes.func.isRequired,
|
|
};
|
|
|
|
export default function BottomButtons({
|
|
importAccountFunc,
|
|
isPrimaryDisabled,
|
|
onActionComplete,
|
|
}) {
|
|
const t = useI18nContext();
|
|
const dispatch = useDispatch();
|
|
|
|
return (
|
|
<Box display={Display.Flex} gap={4}>
|
|
<ButtonSecondary
|
|
onClick={() => {
|
|
dispatch(actions.hideWarning());
|
|
onActionComplete();
|
|
}}
|
|
size={ButtonSecondarySize.Lg}
|
|
block
|
|
>
|
|
{t('cancel')}
|
|
</ButtonSecondary>
|
|
<ButtonPrimary
|
|
onClick={async () => {
|
|
try {
|
|
const result = await importAccountFunc();
|
|
if (result) {
|
|
onActionComplete(true);
|
|
}
|
|
} catch (e) {
|
|
// Take no action
|
|
}
|
|
}}
|
|
disabled={isPrimaryDisabled}
|
|
size={ButtonSecondarySize.Lg}
|
|
data-testid="import-account-confirm-button"
|
|
block
|
|
>
|
|
{t('import')}
|
|
</ButtonPrimary>
|
|
</Box>
|
|
);
|
|
}
|