From 47f7096d35286ce0aadf48ebba467250a00126e9 Mon Sep 17 00:00:00 2001 From: Garrett Bear Date: Wed, 12 Oct 2022 16:07:28 -0700 Subject: [PATCH] 16083: Fix deposit eth popover layout (#16100) * 16083: Fix deposit eth popover layout * adding responsive padding updates * classname fix * Add custom classname option --- ui/components/app/app-components.scss | 1 + .../app/deposit-popover/deposit-popover.js | 225 +++++++++--------- ui/components/app/deposit-popover/index.scss | 16 ++ .../app/deposit-popover/on-ramp-item.js | 72 ++++-- ui/components/ui/box/box.js | 1 + 5 files changed, 180 insertions(+), 135 deletions(-) create mode 100644 ui/components/app/deposit-popover/index.scss diff --git a/ui/components/app/app-components.scss b/ui/components/app/app-components.scss index fad86dbc3..ed008d5f0 100644 --- a/ui/components/app/app-components.scss +++ b/ui/components/app/app-components.scss @@ -24,6 +24,7 @@ @import 'connected-status-indicator/index'; @import 'create-new-vault/create-new-vault.scss'; @import 'custom-spending-cap/index'; +@import 'deposit-popover/index'; @import 'edit-gas-display/index'; @import 'edit-gas-display-education/index'; @import 'edit-gas-fee-button/index'; diff --git a/ui/components/app/deposit-popover/deposit-popover.js b/ui/components/app/deposit-popover/deposit-popover.js index d1b900102..81f1715dc 100644 --- a/ui/components/app/deposit-popover/deposit-popover.js +++ b/ui/components/app/deposit-popover/deposit-popover.js @@ -105,120 +105,123 @@ const DepositPopover = ({ onClose, token }) => { title={t('depositCrypto', [symbol])} subtitle={isTokenDeposit ? '' : t('needCryptoInWallet', [symbol])} onClose={onClose} + className="deposit-popover" > - } - title={t('buyCryptoWithCoinbasePay', [symbol])} - text={t('buyCryptoWithCoinbasePayDescription', [symbol])} - buttonLabel={t('continueToCoinbasePay')} - onButtonClick={() => { - trackEvent({ - category: EVENT.CATEGORIES.ACCOUNTS, - event: EVENT_NAMES.ONRAMP_PROVIDER_SELECTED, - properties: { - onramp_provider_type: EVENT.ONRAMP_PROVIDER_TYPES.COINBASE, - }, - }); - toCoinbasePay(); - }} - hide={ - isTokenDeposit - ? !isBuyableCoinbasePayChain || !isTokenBuyableCoinbasePay - : !isBuyableCoinbasePayChain - } - /> - } - title={t('buyCryptoWithTransak', [symbol])} - text={t('buyCryptoWithTransakDescription', [symbol])} - buttonLabel={t('continueToTransak')} - onButtonClick={() => { - trackEvent({ - category: EVENT.CATEGORIES.ACCOUNTS, - event: EVENT_NAMES.ONRAMP_PROVIDER_SELECTED, - properties: { - onramp_provider_type: EVENT.ONRAMP_PROVIDER_TYPES.TRANSAK, - }, - }); - toTransak(); - }} - hide={ - isTokenDeposit - ? !isBuyableTransakChain || !isTokenBuyableTransak - : !isBuyableTransakChain - } - /> - } - title={t('buyCryptoWithMoonPay', [symbol])} - text={t('buyCryptoWithMoonPayDescription', [symbol])} - buttonLabel={t('continueToMoonPay')} - onButtonClick={() => { - trackEvent({ - category: EVENT.CATEGORIES.ACCOUNTS, - event: EVENT_NAMES.ONRAMP_PROVIDER_SELECTED, - properties: { - onramp_provider_type: EVENT.ONRAMP_PROVIDER_TYPES.MOONPAY, - }, - }); - toMoonPay(); - }} - hide={ - isTokenDeposit - ? !isBuyableMoonPayChain || !isTokenBuyableMoonpay - : !isBuyableMoonPayChain - } - /> - } - title={t('buyWithWyre', [symbol])} - text={t('buyWithWyreDescription', [symbol])} - buttonLabel={t('continueToWyre')} - onButtonClick={() => { - trackEvent({ - category: EVENT.CATEGORIES.ACCOUNTS, - event: EVENT_NAMES.ONRAMP_PROVIDER_SELECTED, - properties: { - onramp_provider_type: EVENT.ONRAMP_PROVIDER_TYPES.WYRE, - }, - }); - toWyre(); - }} - hide={ - isTokenDeposit - ? !isBuyableWyreChain || !isTokenBuyableWyre - : !isBuyableWyreChain - } - /> - - } - title={t('directDepositCrypto', [symbol])} - text={t('directDepositCryptoExplainer', [symbol])} - buttonLabel={t('viewAccount')} - onButtonClick={() => { - trackEvent({ - category: EVENT.CATEGORIES.ACCOUNTS, - event: EVENT_NAMES.ONRAMP_PROVIDER_SELECTED, - properties: { - onramp_provider_type: EVENT.ONRAMP_PROVIDER_TYPES.SELF_DEPOSIT, - }, - }); - goToAccountDetailsModal(); - }} - hide={isTokenDeposit || !isBuyableWyreChain} - /> - - {networkName && ( +
    } - title={t('testFaucet')} - text={t('getEtherFromFaucet', [networkName])} - buttonLabel={t('getEther')} - onButtonClick={() => toFaucet()} - hide={!isTestnet} + logo={} + title={t('buyCryptoWithCoinbasePay', [symbol])} + text={t('buyCryptoWithCoinbasePayDescription', [symbol])} + buttonLabel={t('continueToCoinbasePay')} + onButtonClick={() => { + trackEvent({ + category: EVENT.CATEGORIES.ACCOUNTS, + event: EVENT_NAMES.ONRAMP_PROVIDER_SELECTED, + properties: { + onramp_provider_type: EVENT.ONRAMP_PROVIDER_TYPES.COINBASE, + }, + }); + toCoinbasePay(); + }} + hide={ + isTokenDeposit + ? !isBuyableCoinbasePayChain || !isTokenBuyableCoinbasePay + : !isBuyableCoinbasePayChain + } /> - )} + } + title={t('buyCryptoWithTransak', [symbol])} + text={t('buyCryptoWithTransakDescription', [symbol])} + buttonLabel={t('continueToTransak')} + onButtonClick={() => { + trackEvent({ + category: EVENT.CATEGORIES.ACCOUNTS, + event: EVENT_NAMES.ONRAMP_PROVIDER_SELECTED, + properties: { + onramp_provider_type: EVENT.ONRAMP_PROVIDER_TYPES.TRANSAK, + }, + }); + toTransak(); + }} + hide={ + isTokenDeposit + ? !isBuyableTransakChain || !isTokenBuyableTransak + : !isBuyableTransakChain + } + /> + } + title={t('buyCryptoWithMoonPay', [symbol])} + text={t('buyCryptoWithMoonPayDescription', [symbol])} + buttonLabel={t('continueToMoonPay')} + onButtonClick={() => { + trackEvent({ + category: EVENT.CATEGORIES.ACCOUNTS, + event: EVENT_NAMES.ONRAMP_PROVIDER_SELECTED, + properties: { + onramp_provider_type: EVENT.ONRAMP_PROVIDER_TYPES.MOONPAY, + }, + }); + toMoonPay(); + }} + hide={ + isTokenDeposit + ? !isBuyableMoonPayChain || !isTokenBuyableMoonpay + : !isBuyableMoonPayChain + } + /> + } + title={t('buyWithWyre', [symbol])} + text={t('buyWithWyreDescription', [symbol])} + buttonLabel={t('continueToWyre')} + onButtonClick={() => { + trackEvent({ + category: EVENT.CATEGORIES.ACCOUNTS, + event: EVENT_NAMES.ONRAMP_PROVIDER_SELECTED, + properties: { + onramp_provider_type: EVENT.ONRAMP_PROVIDER_TYPES.WYRE, + }, + }); + toWyre(); + }} + hide={ + isTokenDeposit + ? !isBuyableWyreChain || !isTokenBuyableWyre + : !isBuyableWyreChain + } + /> + + } + title={t('directDepositCrypto', [symbol])} + text={t('directDepositCryptoExplainer', [symbol])} + buttonLabel={t('viewAccount')} + onButtonClick={() => { + trackEvent({ + category: EVENT.CATEGORIES.ACCOUNTS, + event: EVENT_NAMES.ONRAMP_PROVIDER_SELECTED, + properties: { + onramp_provider_type: EVENT.ONRAMP_PROVIDER_TYPES.SELF_DEPOSIT, + }, + }); + goToAccountDetailsModal(); + }} + hide={isTokenDeposit || !isBuyableWyreChain} + /> + + {networkName && ( + } + title={t('testFaucet')} + text={t('getEtherFromFaucet', [networkName])} + buttonLabel={t('getEther')} + onButtonClick={() => toFaucet()} + hide={!isTestnet} + /> + )} +
); }; diff --git a/ui/components/app/deposit-popover/index.scss b/ui/components/app/deposit-popover/index.scss new file mode 100644 index 000000000..df0d11320 --- /dev/null +++ b/ui/components/app/deposit-popover/index.scss @@ -0,0 +1,16 @@ +.deposit-popover { + min-width: 328px; + max-width: 850px; + + @include screen-md-min { + width: 100% !important; + } + + &__on-ramp-item { + border-bottom: 1px solid var(--color-border-muted); + + &:last-child { + border-bottom: none; + } + } +} diff --git a/ui/components/app/deposit-popover/on-ramp-item.js b/ui/components/app/deposit-popover/on-ramp-item.js index 505253592..c80d121e4 100644 --- a/ui/components/app/deposit-popover/on-ramp-item.js +++ b/ui/components/app/deposit-popover/on-ramp-item.js @@ -1,11 +1,19 @@ import React from 'react'; import PropTypes from 'prop-types'; +import classnames from 'classnames'; import Button from '../../ui/button'; import Box from '../../ui/box'; import Typography from '../../ui/typography'; -import { COLORS, FRACTIONS } from '../../../helpers/constants/design-system'; +import { + ALIGN_ITEMS, + DISPLAY, + FLEX_WRAP, + BLOCK_SIZES, + JUSTIFY_CONTENT, +} from '../../../helpers/constants/design-system'; const OnRampItem = ({ + className, logo, title, text, @@ -17,35 +25,50 @@ const OnRampItem = ({ return null; } return ( - + - {logo} - - {title} - - + + + {title} + + {text} + + - {text} - - @@ -56,6 +79,7 @@ const OnRampItem = ({ }; OnRampItem.propTypes = { + className: PropTypes.string, logo: PropTypes.node.isRequired, title: PropTypes.string.isRequired, text: PropTypes.string.isRequired, diff --git a/ui/components/ui/box/box.js b/ui/components/ui/box/box.js index 703ec63bd..30b379ebe 100644 --- a/ui/components/ui/box/box.js +++ b/ui/components/ui/box/box.js @@ -330,6 +330,7 @@ Box.propTypes = { height: MultipleBlockSizes, backgroundColor: MultipleBackgroundColors, className: PropTypes.string, + style: PropTypes.object, /** * The polymorphic `as` prop allows you to change the root HTML element of the Box component * Defaults to 'div'