Skip to content

Commit 363a8ef

Browse files
authored
Merge pull request #378 from reservoirprotocol/ted/relay-6285-content-overflows-on-trade-detail-page
Update SwapConfirmationStep ui to fix overflow
2 parents f369d27 + 9a34e7e commit 363a8ef

File tree

3 files changed

+29
-12
lines changed

3 files changed

+29
-12
lines changed

.changeset/real-jokes-mate.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@reservoir0x/relay-kit-ui': patch
3+
---
4+
5+
Update SwapConfirmationStep ui to fix overflow

packages/ui/src/components/common/TransactionModal/SwapModal.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,7 @@ const InnerSwapModal: FC<InnerSwapModalProps> = ({
285285
toToken={toToken}
286286
fromAmountFormatted={fromAmountFormatted}
287287
toAmountFormatted={toAmountFormatted}
288+
quote={quote}
288289
/>
289290
) : null}
290291
{progressStep === TransactionProgressStep.Validating ? (

packages/ui/src/components/common/TransactionModal/steps/SwapConfirmationStep.tsx

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,25 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
99
import { LoadingSpinner } from '../../LoadingSpinner.js'
1010
import { type Token } from '../../../../types/index.js'
1111
import { faArrowRight } from '@fortawesome/free-solid-svg-icons/faArrowRight'
12+
import type { useQuote } from '@reservoir0x/relay-kit-hooks'
13+
import { formatDollar } from '../../../../utils/numbers.js'
1214

1315
type SwapConfirmationStepProps = {
1416
fromToken?: Token
1517
toToken?: Token
18+
quote?: ReturnType<typeof useQuote>['data']
1619
fromAmountFormatted: string
1720
toAmountFormatted: string
1821
}
1922

2023
export const SwapConfirmationStep: FC<SwapConfirmationStepProps> = ({
2124
fromToken,
2225
toToken,
26+
quote,
2327
fromAmountFormatted,
2428
toAmountFormatted
2529
}) => {
30+
const details = quote?.details
2631
return (
2732
<>
2833
<Flex
@@ -41,20 +46,22 @@ export const SwapConfirmationStep: FC<SwapConfirmationStepProps> = ({
4146
width: '100%'
4247
}}
4348
>
44-
<Text style="subtitle2" color="subtle">
45-
From
46-
</Text>
47-
48-
<Flex align="center" css={{ gap: '2', cursor: 'pointer' }}>
49+
<Flex
50+
direction="column"
51+
align="start"
52+
css={{ gap: '1', cursor: 'pointer' }}
53+
>
4954
<ChainTokenIcon
5055
chainId={fromToken?.chainId}
5156
tokenlogoURI={fromToken?.logoURI}
5257
css={{ height: 32, width: 32 }}
5358
/>
54-
55-
<Text style="subtitle1" ellipsify>
59+
<Text style="h6" ellipsify>
5660
{fromAmountFormatted} {fromToken?.symbol}
5761
</Text>
62+
<Text style="subtitle3" color="subtle">
63+
{formatDollar(Number(details?.currencyIn?.amountUsd))}
64+
</Text>
5865
</Flex>
5966
</Flex>
6067
<Text
@@ -77,18 +84,22 @@ export const SwapConfirmationStep: FC<SwapConfirmationStepProps> = ({
7784
width: '100%'
7885
}}
7986
>
80-
<Text style="subtitle2" color="subtle">
81-
To
82-
</Text>
83-
<Flex align="center" css={{ gap: '2', cursor: 'pointer' }}>
87+
<Flex
88+
direction="column"
89+
align="start"
90+
css={{ gap: '1', cursor: 'pointer' }}
91+
>
8492
<ChainTokenIcon
8593
chainId={toToken?.chainId}
8694
tokenlogoURI={toToken?.logoURI}
8795
css={{ height: 32, width: 32 }}
8896
/>
89-
<Text style="subtitle1" ellipsify>
97+
<Text style="h6" ellipsify>
9098
{toAmountFormatted} {toToken?.symbol}
9199
</Text>
100+
<Text style="subtitle3" color="subtle">
101+
{formatDollar(Number(details?.currencyOut?.amountUsd))}
102+
</Text>
92103
</Flex>
93104
</Flex>
94105
</Flex>

0 commit comments

Comments
 (0)