Skip to content

Commit

Permalink
Ensure footer stays on screen
Browse files Browse the repository at this point in the history
  • Loading branch information
darkwing committed Dec 2, 2020
1 parent c2c811a commit 0918248
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 14 deletions.
4 changes: 3 additions & 1 deletion ui/app/pages/swaps/swaps-footer/swaps-footer.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@ export default function SwapsFooter({
disabled,
showTermsOfService,
showTopBorder,
className = '',
}) {
const t = useContext(I18nContext)

return (
<div className="swaps-footer">
<div
className={classnames('swaps-footer__buttons', {
className={classnames('swaps-footer__buttons', className, {
'swaps-footer__buttons--border': showTopBorder,
})}
>
Expand Down Expand Up @@ -62,4 +63,5 @@ SwapsFooter.propTypes = {
disabled: PropTypes.bool,
showTermsOfService: PropTypes.bool,
showTopBorder: PropTypes.bool,
className: PropTypes.string,
}
6 changes: 5 additions & 1 deletion ui/app/pages/swaps/view-quote/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
&--thin {
min-height: 36px;
}

display: flex;
}
}
Expand Down Expand Up @@ -211,4 +211,8 @@
&__metamask-rate-info-icon {
margin-left: 4px;
}

&__thin-swaps-footer {
max-height: 82px;
}
}
29 changes: 17 additions & 12 deletions ui/app/pages/swaps/view-quote/view-quote.js
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,17 @@ export default function ViewQuote() {
: 'ETH',
])

const viewQuotePriceDifferenceComponent = (
<ViewQuotePriceDifference
usedQuote={usedQuote}
sourceTokenValue={sourceTokenValue}
destinationTokenValue={destinationTokenValue}
/>
)

const isShowingWarning =
showInsufficientWarning || viewQuotePriceDifferenceComponent !== null

return (
<div className="view-quote">
<div className="view-quote__content">
Expand All @@ -477,16 +488,10 @@ export default function ViewQuote() {
)}
<div
className={classnames('view-quote__warning-wrapper', {
'view-quote__warning-wrapper--thin': !showInsufficientWarning,
'view-quote__warning-wrapper--thin': !isShowingWarning,
})}
>
{!showInsufficientWarning && (
<ViewQuotePriceDifference
usedQuote={usedQuote}
sourceTokenValue={sourceTokenValue}
destinationTokenValue={destinationTokenValue}
/>
)}
{!showInsufficientWarning && viewQuotePriceDifferenceComponent}
{showInsufficientWarning && (
<ActionableMessage
message={actionableInsufficientMessage}
Expand All @@ -496,7 +501,7 @@ export default function ViewQuote() {
</div>
<div
className={classnames('view-quote__countdown-timer-container', {
'view-quote__countdown-timer-container--thin': showInsufficientWarning,
'view-quote__countdown-timer-container--thin': isShowingWarning,
})}
>
<CountdownTimer
Expand All @@ -508,7 +513,7 @@ export default function ViewQuote() {
</div>
<div
className={classnames('view-quote__main-quote-summary-container', {
'view-quote__main-quote-summary-container--thin': showInsufficientWarning,
'view-quote__main-quote-summary-container--thin': isShowingWarning,
})}
>
<MainQuoteSummary
Expand Down Expand Up @@ -552,7 +557,7 @@ export default function ViewQuote() {
</div>
<div
className={classnames('view-quote__fee-card-container', {
'view-quote__fee-card-container--thin': showInsufficientWarning,
'view-quote__fee-card-container--thin': isShowingWarning,
'view-quote__fee-card-container--three-rows':
approveTxParams && (!balanceError || warningHidden),
})}
Expand Down Expand Up @@ -589,7 +594,7 @@ export default function ViewQuote() {
submitText={t('swap')}
onCancel={async () => await dispatch(navigateBackToBuildQuote(history))}
disabled={balanceError || gasPrice === null || gasPrice === undefined}
className={showInsufficientWarning && 'view-quote__thin-swaps-footer'}
className={isShowingWarning && 'view-quote__thin-swaps-footer'}
showTermsOfService
showTopBorder
/>
Expand Down

0 comments on commit 0918248

Please sign in to comment.