1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00
metamask-extension/ui/components/app/detected-token/detected-token-ignored-popover/detected-token-ignored-popover.js
jainex 3d9457e517
Replacing deprecated Popover with Modal (#20413)
* Replacing deprecated Popover with Modal

* Replacing deprecated Popover with Modal in detected-token-ignored-popover

* Remove unused code

* fix hover problem

* update footerButton size to large

* Lint fix

* UI updates and removing unused CSS

* reset chnages in edit-gas-popover.component.js

---------

Co-authored-by: georgewrmarshall <george.marshall@consensys.net>
2023-08-18 09:54:50 -07:00

89 lines
2.3 KiB
JavaScript

import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { useI18nContext } from '../../../../hooks/useI18nContext';
import {
Display,
JustifyContent,
} from '../../../../helpers/constants/design-system';
import {
Text,
Modal,
ModalOverlay,
ModalContent,
ModalHeader,
Button,
BUTTON_VARIANT,
Box,
BUTTON_SIZES,
} from '../../../component-library';
const DetectedTokenIgnoredPopover = ({
partiallyIgnoreDetectedTokens,
onCancelIgnore,
handleClearTokensSelection,
isOpen,
}) => {
const t = useI18nContext();
return (
<Modal
isOpen={isOpen}
className={classNames('detected-token-ignored-popover', {
'detected-token-ignored-popover--import': partiallyIgnoreDetectedTokens,
'detected-token-ignored-popover--ignore':
!partiallyIgnoreDetectedTokens,
})}
onClose={onCancelIgnore}
autoFocus={false}
>
<ModalOverlay />
<ModalContent>
<ModalHeader marginBottom={4}>
{partiallyIgnoreDetectedTokens
? t('importSelectedTokens')
: t('areYouSure')}
</ModalHeader>
<Text marginBottom={4}>
{partiallyIgnoreDetectedTokens
? t('importSelectedTokensDescription')
: t('ignoreTokenWarning')}
</Text>
<Box
display={Display.Flex}
justifyContent={JustifyContent.center}
gap={4}
>
<Button
className="detected-token-ignored-popover__ignore-button"
block
variant={BUTTON_VARIANT.SECONDARY}
onClick={onCancelIgnore}
size={BUTTON_SIZES.LG}
>
{t('cancel')}
</Button>
<Button
className="detected-token-ignored-popover__import-button"
block
variant={BUTTON_VARIANT.PRIMARY}
onClick={handleClearTokensSelection}
size={BUTTON_SIZES.LG}
>
{t('confirm')}
</Button>
</Box>
</ModalContent>
</Modal>
);
};
DetectedTokenIgnoredPopover.propTypes = {
partiallyIgnoreDetectedTokens: PropTypes.bool.isRequired,
onCancelIgnore: PropTypes.func.isRequired,
handleClearTokensSelection: PropTypes.func.isRequired,
isOpen: PropTypes.bool.isRequired,
};
export default DetectedTokenIgnoredPopover;