Skip to content

Commit

Permalink
chore: added custom width when hardware sign popover is fullscreen
Browse files Browse the repository at this point in the history
  • Loading branch information
caiquecruz committed May 27, 2024
1 parent 9e97ea6 commit 3d75c5d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ const QRHardwarePopover = () => {
<Popover
title={title}
onClose={showWalletImporter ? walletImporterCancel : signRequestCancel}
customWidth="800px"
>
{showWalletImporter && (
<QRHardwareWalletImporter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,11 @@ const Player = ({ type, cbor, cancelQRHardwareSignRequest, toRead }) => {
backgroundColor: 'var(--qr-code-white-background)',
}}
>
<QRCode value={currentQRCode.toUpperCase()} size={qrSize} />
<QRCode
value={currentQRCode.toUpperCase()}
size={qrSize}
level={level}
/>
</div>
</Box>
<Box paddingBottom={4} paddingLeft={4} paddingRight={4}>
Expand Down
11 changes: 11 additions & 0 deletions ui/components/ui/popover/popover.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import ReactDOM from 'react-dom';
import PropTypes from 'prop-types';
import classnames from 'classnames';
import { useI18nContext } from '../../../hooks/useI18nContext';
import { getEnvironmentType } from '../../../../app/scripts/lib/util';
import { ENVIRONMENT_TYPE_FULLSCREEN } from '../../../../shared/constants/app';
import Box from '../box';
import {
AlignItems,
Expand Down Expand Up @@ -49,6 +51,9 @@ const defaultFooterProps = {
padding: [4, 6, 6],
};

const environmentType = getEnvironmentType();
const isFullScreen = environmentType === ENVIRONMENT_TYPE_FULLSCREEN;

/**
* @deprecated The `<Popover>` component has been deprecated in favor of the new `<Modal>` component from the component-library.
* Please update your code to use the new `<Modal>` component instead, which can be found at ui/components/component-library/modal/modal.tsx.
Expand Down Expand Up @@ -78,6 +83,7 @@ const Popover = ({
headerProps = defaultHeaderProps,
contentProps = defaultContentProps,
footerProps = defaultFooterProps,
customWidth,
}) => {
const t = useI18nContext();
const showHeader = title || onBack || subtitle || onClose;
Expand Down Expand Up @@ -137,6 +143,7 @@ const Popover = ({
<section
className={classnames('popover-wrap', className)}
ref={popoverRef}
style={{ width: isFullScreen ? customWidth : null }}
>
{showArrow ? <div className="popover-arrow" /> : null}
{showHeader && <Header />}
Expand Down Expand Up @@ -259,6 +266,10 @@ Popover.propTypes = {
* Box props for the footer
*/
footerProps: PropTypes.shape({ ...Box.propTypes }),
/**
* Box props for custom width
*/
customWidth: PropTypes.string,
};

/**
Expand Down

0 comments on commit 3d75c5d

Please sign in to comment.