mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-02 06:07:06 +01:00
ab4843f06b
* UX: Multichain: Implement Account Details Popover * Styling account details popover * using ButtonSecondary with variant, removing Text * adding account-details jest test * Close popover when outside area clicked * Move all export functionality into the popover * Improve jest tests * Implement new design for export key screens * Hide warning when popover is closed * Vertically align the copy button * Move AccountDetailsDisplay to its own file * Move authentication to its own file * Move private key to its own component * Fix misalignment of avatar on display screen * Move private key to its own component * Update ui/components/multichain/account-details/account-details-authenticate.js Co-authored-by: Nidhi Kumari <nidhi.kumari@consensys.net> * Update ui/components/multichain/account-details/account-details.test.js Co-authored-by: Nidhi Kumari <nidhi.kumari@consensys.net> * Prevent account name overflow, update text size * Use FormTextField * Add analytics * Move location of accountDetailsAddress * Ensure passsword input is used --------- Co-authored-by: Victor Thomas <10986371+vthomas13@users.noreply.github.com> Co-authored-by: Nidhi Kumari <nidhi.kumari@consensys.net>
70 lines
1.9 KiB
JavaScript
70 lines
1.9 KiB
JavaScript
import React from 'react';
|
|
import PropTypes from 'prop-types';
|
|
import {
|
|
BannerAlert,
|
|
ButtonIcon,
|
|
ButtonPrimary,
|
|
IconName,
|
|
Text,
|
|
} from '../../component-library';
|
|
import {
|
|
AlignItems,
|
|
BorderColor,
|
|
BorderRadius,
|
|
DISPLAY,
|
|
FLEX_DIRECTION,
|
|
SEVERITIES,
|
|
TextVariant,
|
|
} from '../../../helpers/constants/design-system';
|
|
import { useI18nContext } from '../../../hooks/useI18nContext';
|
|
import Box from '../../ui/box/box';
|
|
import { useCopyToClipboard } from '../../../hooks/useCopyToClipboard';
|
|
|
|
export const AccountDetailsKey = ({ accountName, onClose, privateKey }) => {
|
|
const t = useI18nContext();
|
|
|
|
const [privateKeyCopied, handlePrivateKeyCopy] = useCopyToClipboard();
|
|
|
|
return (
|
|
<>
|
|
<Text
|
|
marginTop={6}
|
|
variant={TextVariant.bodySm}
|
|
style={{ wordBreak: 'break-word' }}
|
|
>
|
|
{t('privateKeyCopyWarning', [accountName])}
|
|
</Text>
|
|
<Box
|
|
display={DISPLAY.FLEX}
|
|
flexDirection={FLEX_DIRECTION.ROW}
|
|
alignItems={AlignItems.center}
|
|
borderRadius={BorderRadius.SM}
|
|
borderWidth={1}
|
|
borderColor={BorderColor.default}
|
|
padding={4}
|
|
gap={4}
|
|
>
|
|
<Text variant={TextVariant.bodySm} style={{ wordBreak: 'break-word' }}>
|
|
{privateKey}
|
|
</Text>
|
|
<ButtonIcon
|
|
onClick={() => handlePrivateKeyCopy(privateKey)}
|
|
iconName={privateKeyCopied ? IconName.CopySuccess : IconName.Copy}
|
|
/>
|
|
</Box>
|
|
<BannerAlert severity={SEVERITIES.DANGER} marginTop={4}>
|
|
<Text variant={TextVariant.bodySm}>{t('privateKeyWarning')}</Text>
|
|
</BannerAlert>
|
|
<ButtonPrimary marginTop={6} onClick={onClose}>
|
|
{t('done')}
|
|
</ButtonPrimary>
|
|
</>
|
|
);
|
|
};
|
|
|
|
AccountDetailsKey.propTypes = {
|
|
accountName: PropTypes.string.isRequired,
|
|
onClose: PropTypes.func.isRequired,
|
|
privateKey: PropTypes.string.isRequired,
|
|
};
|