Skip to content

Commit

Permalink
Merge pull request #362 from reservoirprotocol/ted/update-chain-icons…
Browse files Browse the repository at this point in the history
…-for-single-chain-mode

Add chain icon to token selector in single chain mode
  • Loading branch information
ted-palmer authored Nov 11, 2024
2 parents ad7e63e + 604b9f6 commit b5e62ae
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/orange-sloths-search.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@reservoir0x/relay-kit-ui': patch
---

Add chain icon to token selector in single chain mode
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,22 @@ import {
Button,
Flex,
Text,
Box
Box,
ChainTokenIcon
} from '../../../../components/primitives/index.js'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { faChevronDown, faCoins } from '@fortawesome/free-solid-svg-icons'

type SwapWidgetTokenTriggerProps = {
token?: Token
locked?: boolean
isSingleChainLocked?: boolean
}

export const SwapWidgetTokenTrigger: FC<SwapWidgetTokenTriggerProps> = ({
token,
locked
locked,
isSingleChainLocked
}) => {
const isValidTokenLogo = token?.logoURI && token.logoURI !== 'missing.png'

Expand Down Expand Up @@ -44,7 +47,13 @@ export const SwapWidgetTokenTrigger: FC<SwapWidgetTokenTriggerProps> = ({
}}
>
<Flex align="center" css={{ gap: '2' }}>
{isValidTokenLogo ? (
{isSingleChainLocked ? (
<ChainTokenIcon
chainId={token.chainId}
tokenlogoURI={token.logoURI}
css={{ width: 24, height: 24 }}
/>
) : isValidTokenLogo ? (
<img
alt={token.name}
src={token.logoURI}
Expand Down
2 changes: 2 additions & 0 deletions packages/ui/src/components/widgets/SwapWidget/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,7 @@ const SwapWidget: FC<SwapWidgetProps> = ({
token.chainId === fromToken?.chainId
).length === 1)
}
isSingleChainLocked={isSingleChainLocked}
/>
</div>
}
Expand Down Expand Up @@ -750,6 +751,7 @@ const SwapWidget: FC<SwapWidgetProps> = ({
token.chainId === toToken?.chainId
).length === 1)
}
isSingleChainLocked={isSingleChainLocked}
/>
</div>
}
Expand Down

0 comments on commit b5e62ae

Please sign in to comment.