span {
- margin-left: 4px;
- }
- }
-
&__quote-details-top {
- height: 94px;
display: flex;
flex-flow: column;
justify-content: center;
align-items: center;
width: 100%;
- padding: 12px;
- padding-top: 2px;
- margin-top: 4px;
- }
-
- &__bold {
- font-weight: 900;
- }
-
- &__quote-small-white {
- white-space: nowrap;
- width: 100%;
- text-align: center;
- font-size: 14px;
- margin-bottom: 8px;
- margin-top: 6px;
}
&__quote-large {
display: flex;
- align-items: flex-end;
+ align-items: flex-start;
+ margin-top: 8px;
+ height: 50px;
}
&__quote-large-number {
- font-size: 40px;
- line-height: 32px;
- margin-right: 6px;
- }
-
- &__quote-large-symbol {
- display: flex;
- align-items: flex-end;
- font-size: 32px;
- line-height: 32px;
+ font-size: 60px;
+ line-height: 48px;
}
&__quote-large-white {
@@ -104,7 +110,10 @@
justify-content: center;
align-items: center;
width: 287px;
- border-top: 1px solid rgba(255, 255, 255, 0.2);
- height: 42px;
+ margin-top: 14px;
+ }
+
+ &__exchange-rate-display {
+ color: $Grey-500;
}
}
diff --git a/ui/app/pages/swaps/main-quote-summary/main-quote-summary.js b/ui/app/pages/swaps/main-quote-summary/main-quote-summary.js
index 0af388c8f..e25340449 100644
--- a/ui/app/pages/swaps/main-quote-summary/main-quote-summary.js
+++ b/ui/app/pages/swaps/main-quote-summary/main-quote-summary.js
@@ -1,94 +1,77 @@
-import React, { useContext } from 'react'
+import React from 'react'
import PropTypes from 'prop-types'
import BigNumber from 'bignumber.js'
-import classnames from 'classnames'
-import { I18nContext } from '../../../contexts/i18n'
import { calcTokenAmount } from '../../../helpers/utils/token-util'
import { toPrecisionWithoutTrailingZeros } from '../../../helpers/utils/util'
import Tooltip from '../../../components/ui/tooltip'
-import SunCheckIcon from '../../../components/ui/icon/sun-check-icon.component'
+import UrlIcon from '../../../components/ui/url-icon'
import ExchangeRateDisplay from '../exchange-rate-display'
import { formatSwapsValueForDisplay } from '../swaps.util'
-import QuoteBackdrop from './quote-backdrop'
-function getFontSizes (fontSizeScore) {
- if (fontSizeScore <= 11) {
- return [40, 32]
- }
- if (fontSizeScore <= 16) {
- return [30, 24]
- }
- return [24, 14]
-}
-
-function getLineHeight (fontSizeScore) {
- if (fontSizeScore <= 11) {
- return 32
+function getFontSizesAndLineHeights (fontSizeScore) {
+ if (fontSizeScore <= 9) {
+ return [60, 48]
}
- if (fontSizeScore <= 16) {
- return 26
+ if (fontSizeScore <= 13) {
+ return [40, 32]
}
- return 18
-}
-
-// Returns a numerical value based on the length of the two passed strings: amount and symbol.
-// The returned value equals the number of digits in the amount string plus a value calculated
-// from the length of the symbol string. The returned number will be passed to the getFontSizes function
-// to determine the font size to apply to the amount and symbol strings when rendered. The
-// desired maximum digits and letters to show in the ultimately rendered string is 20, and in
-// such cases there can also be ellipsis shown and a decimal, combinding for a rendered "string"
-// length of ~22. As the symbol will always have a smaller font size than the amount, the
-// additive value of the symbol length to the font size score is corrected based on the total
-// number of alphanumeric characters in both strings and the desired rendered length of 22.
-function getFontSizeScore (amount, symbol) {
- const amountLength = amount.match(/\d+/gu).join('').length
- const symbolModifier = Math.min((amountLength + symbol.length) / 22, 1)
- return amountLength + (symbol.length * symbolModifier)
+ return [26, 15]
}
export default function MainQuoteSummary ({
- isBestQuote,
sourceValue,
sourceSymbol,
sourceDecimals,
+ sourceIconUrl,
destinationValue,
destinationSymbol,
destinationDecimals,
+ destinationIconUrl,
}) {
- const t = useContext(I18nContext)
-
const sourceAmount = toPrecisionWithoutTrailingZeros(calcTokenAmount(sourceValue, sourceDecimals).toString(10), 12)
const destinationAmount = calcTokenAmount(destinationValue, destinationDecimals)
const amountToDisplay = formatSwapsValueForDisplay(destinationAmount)
- const fontSizeScore = getFontSizeScore(amountToDisplay, destinationSymbol)
- const [numberFontSize, symbolFontSize] = getFontSizes(fontSizeScore)
- const lineHeight = getLineHeight(fontSizeScore)
-
+ const amountDigitLength = amountToDisplay.match(/\d+/gu).join('').length
+ const [numberFontSize, lineHeight] = getFontSizesAndLineHeights(amountDigitLength)
let ellipsedAmountToDisplay = amountToDisplay
- if (fontSizeScore > 20) {
- ellipsedAmountToDisplay = `${amountToDisplay.slice(0, amountToDisplay.length - (fontSizeScore - 20))}...`
+ if (amountDigitLength > 20) {
+ ellipsedAmountToDisplay = `${amountToDisplay.slice(0, 20)}...`
}
return (
-
-
-
-
- {isBestQuote && }
- {isBestQuote && t('swapsBestQuote')}
-
-
- {t('swapsConvertToAbout', [{`${sourceAmount} ${sourceSymbol}`}])}
-
+
+
+ { formatSwapsValueForDisplay(sourceAmount) }
+
+
+ { sourceSymbol }
+
+
+
+
+ { destinationSymbol }
+
{`${ellipsedAmountToDisplay}`}
- {`${destinationSymbol}`}
@@ -110,8 +92,9 @@ export default function MainQuoteSummary ({
secondaryTokenValue={destinationValue}
secondaryTokenDecimals={destinationDecimals}
secondaryTokenSymbol={destinationSymbol}
- className="exchange-rate-display--white"
- arrowColor="white"
+ arrowColor="#037DD6"
+ boldSymbols={false}
+ className="main-quote-summary__exchange-rate-display"
/>
@@ -120,7 +103,6 @@ export default function MainQuoteSummary ({
}
MainQuoteSummary.propTypes = {
- isBestQuote: PropTypes.bool,
sourceValue: PropTypes.oneOfType([
PropTypes.string,
PropTypes.instanceOf(BigNumber),
@@ -133,4 +115,6 @@ MainQuoteSummary.propTypes = {
]).isRequired,
destinationDecimals: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
destinationSymbol: PropTypes.string.isRequired,
+ sourceIconUrl: PropTypes.string,
+ destinationIconUrl: PropTypes.string,
}
diff --git a/ui/app/pages/swaps/main-quote-summary/main-quote-summary.stories.js b/ui/app/pages/swaps/main-quote-summary/main-quote-summary.stories.js
index f6c1ffeb2..239175d75 100644
--- a/ui/app/pages/swaps/main-quote-summary/main-quote-summary.stories.js
+++ b/ui/app/pages/swaps/main-quote-summary/main-quote-summary.stories.js
@@ -1,5 +1,5 @@
import React from 'react'
-import { text, number, boolean } from '@storybook/addon-knobs/react'
+import { text, number } from '@storybook/addon-knobs/react'
import MainQuoteSummary from './main-quote-summary'
export default {
@@ -8,28 +8,17 @@ export default {
export const BestQuote = () => {
return (
-
- )
-}
-
-export const NotBestQuote = () => {
- return (
-
+
+
+
)
}
diff --git a/ui/app/pages/swaps/swaps.util.js b/ui/app/pages/swaps/swaps.util.js
index 14f9204d2..36f3c697a 100644
--- a/ui/app/pages/swaps/swaps.util.js
+++ b/ui/app/pages/swaps/swaps.util.js
@@ -375,6 +375,7 @@ export function quotesToRenderableData (quotes, gasPrice, conversionRate, curren
destinationTokenDecimals: destinationTokenInfo.decimals,
destinationTokenSymbol: destinationTokenInfo.symbol,
destinationTokenValue: formatSwapsValueForDisplay(destinationValue),
+ destinationIconUrl: destinationTokenInfo.iconUrl,
isBestQuote: quote.isBestQuote,
liquiditySourceKey,
feeInEth,
@@ -386,6 +387,7 @@ export function quotesToRenderableData (quotes, gasPrice, conversionRate, curren
sourceTokenDecimals: sourceTokenInfo.decimals,
sourceTokenSymbol: sourceTokenInfo.symbol,
sourceTokenValue: sourceValue,
+ sourceTokenIconUrl: sourceTokenInfo.iconUrl,
ethValueOfTrade,
minimumAmountReceived,
metaMaskFee: fee,
diff --git a/ui/app/pages/swaps/view-quote/index.scss b/ui/app/pages/swaps/view-quote/index.scss
index 1b76853fb..a7fef1f42 100644
--- a/ui/app/pages/swaps/view-quote/index.scss
+++ b/ui/app/pages/swaps/view-quote/index.scss
@@ -44,13 +44,13 @@
display: flex;
align-items: center;
justify-content: center;
+ min-height: 46px;
}
&__view-other-button,
&__view-other-button-fade {
display: flex;
align-items: center;
- margin-bottom: 16px;
position: absolute;
@include H7;
@@ -87,10 +87,12 @@
}
&__insufficient-eth-warning-wrapper {
- margin-top: 8px;
width: 100%;
align-items: center;
justify-content: center;
+ width: intrinsic; /* Safari/WebKit uses a non-standard name */
+ width: max-content;
+ max-width: 340px;
@media screen and (min-width: 576px) {
min-height: 36px;
@@ -127,7 +129,6 @@
&__fee-card-container {
width: 100%;
- margin-top: 8px;
margin-bottom: 8px;
@media screen and (min-width: 576px) {
@@ -139,21 +140,8 @@
}
}
- &__main-quote-summary-container {
- margin-top: 24px;
-
- @media screen and (max-width: 576px) {
- margin-top: 0;
- }
-
- &--thin {
- margin-top: 8px;
- }
- }
-
&__metamask-rate {
display: flex;
- margin-top: 8%;
}
&__metamask-rate-text {
diff --git a/ui/app/pages/swaps/view-quote/view-quote.js b/ui/app/pages/swaps/view-quote/view-quote.js
index a658abfe2..24a0008fa 100644
--- a/ui/app/pages/swaps/view-quote/view-quote.js
+++ b/ui/app/pages/swaps/view-quote/view-quote.js
@@ -114,7 +114,6 @@ export default function ViewQuote () {
const topQuote = useSelector(getTopQuote)
const usedQuote = selectedQuote || topQuote
- const { isBestQuote } = usedQuote
const fetchParamsSourceToken = fetchParams?.sourceToken
const usedGasLimit = (
@@ -191,9 +190,11 @@ export default function ViewQuote () {
destinationTokenDecimals,
destinationTokenSymbol,
destinationTokenValue,
+ destinationIconUrl,
sourceTokenDecimals,
sourceTokenSymbol,
sourceTokenValue,
+ sourceTokenIconUrl,
} = renderableDataForUsedQuote
const { feeInFiat, feeInEth } = getRenderableNetworkFeesForQuote(
@@ -481,24 +482,19 @@ export default function ViewQuote () {
labelKey="swapNewQuoteIn"
/>