Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update SwapConfirmationStep ui to fix overflow #378

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/real-jokes-mate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@reservoir0x/relay-kit-ui': patch
---

Update SwapConfirmationStep ui to fix overflow
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ const InnerSwapModal: FC<InnerSwapModalProps> = ({
toToken={toToken}
fromAmountFormatted={fromAmountFormatted}
toAmountFormatted={toAmountFormatted}
quote={quote}
/>
) : null}
{progressStep === TransactionProgressStep.Validating ? (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,25 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { LoadingSpinner } from '../../LoadingSpinner.js'
import { type Token } from '../../../../types/index.js'
import { faArrowRight } from '@fortawesome/free-solid-svg-icons/faArrowRight'
import type { useQuote } from '@reservoir0x/relay-kit-hooks'
import { formatDollar } from '../../../../utils/numbers.js'

type SwapConfirmationStepProps = {
fromToken?: Token
toToken?: Token
quote?: ReturnType<typeof useQuote>['data']
fromAmountFormatted: string
toAmountFormatted: string
}

export const SwapConfirmationStep: FC<SwapConfirmationStepProps> = ({
fromToken,
toToken,
quote,
fromAmountFormatted,
toAmountFormatted
}) => {
const details = quote?.details
return (
<>
<Flex
Expand All @@ -41,20 +46,22 @@ export const SwapConfirmationStep: FC<SwapConfirmationStepProps> = ({
width: '100%'
}}
>
<Text style="subtitle2" color="subtle">
From
</Text>

<Flex align="center" css={{ gap: '2', cursor: 'pointer' }}>
<Flex
direction="column"
align="start"
css={{ gap: '1', cursor: 'pointer' }}
>
<ChainTokenIcon
chainId={fromToken?.chainId}
tokenlogoURI={fromToken?.logoURI}
css={{ height: 32, width: 32 }}
/>

<Text style="subtitle1" ellipsify>
<Text style="h6" ellipsify>
{fromAmountFormatted} {fromToken?.symbol}
</Text>
<Text style="subtitle3" color="subtle">
{formatDollar(Number(details?.currencyIn?.amountUsd))}
</Text>
</Flex>
</Flex>
<Text
Expand All @@ -77,18 +84,22 @@ export const SwapConfirmationStep: FC<SwapConfirmationStepProps> = ({
width: '100%'
}}
>
<Text style="subtitle2" color="subtle">
To
</Text>
<Flex align="center" css={{ gap: '2', cursor: 'pointer' }}>
<Flex
direction="column"
align="start"
css={{ gap: '1', cursor: 'pointer' }}
>
<ChainTokenIcon
chainId={toToken?.chainId}
tokenlogoURI={toToken?.logoURI}
css={{ height: 32, width: 32 }}
/>
<Text style="subtitle1" ellipsify>
<Text style="h6" ellipsify>
{toAmountFormatted} {toToken?.symbol}
</Text>
<Text style="subtitle3" color="subtle">
{formatDollar(Number(details?.currencyOut?.amountUsd))}
</Text>
</Flex>
</Flex>
</Flex>
Expand Down