-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add functionality to support custom tokens
- Loading branch information
1 parent
bf95e72
commit a1aa0af
Showing
57 changed files
with
2,181 additions
and
156 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
widget/embedded/src/components/BlockchainSelectorButton/BlockchainSelectorButton.styles.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { darkTheme, styled } from '@rango-dev/ui'; | ||
|
||
export const InputContainer = styled('div', { | ||
display: 'flex', | ||
justifyContent: 'space-between', | ||
width: '100%', | ||
height: '$40', | ||
padding: '$4 $10', | ||
borderRadius: '$sm', | ||
cursor: 'pointer', | ||
alignItems: 'center', | ||
backgroundColor: '$neutral300', | ||
[`.${darkTheme} &`]: { | ||
backgroundColor: '$neutral400', | ||
}, | ||
|
||
'&:hover': { | ||
backgroundColor: '$secondary100', | ||
[`.${darkTheme} &`]: { | ||
backgroundColor: '$neutral500', | ||
}, | ||
}, | ||
variants: { | ||
disabled: { | ||
true: { | ||
cursor: 'default', | ||
'&:hover': { | ||
borderColor: '$neutral300', | ||
'& svg': { | ||
color: '$neutral700', | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}); | ||
|
||
export const Container = styled('div', { | ||
display: 'flex', | ||
flexDirection: 'column', | ||
width: '100%', | ||
'.title_typography': { | ||
textTransform: 'capitalize', | ||
}, | ||
}); | ||
|
||
export const FlexContainer = styled('div', { | ||
display: 'flex', | ||
}); |
47 changes: 47 additions & 0 deletions
47
widget/embedded/src/components/BlockchainSelectorButton/BlockchainSelectorButton.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import type { PropTypes } from './BlockchainSelectorButton.types'; | ||
|
||
import { ChevronRightIcon, Divider, Image, Typography } from '@rango-dev/ui'; | ||
import React from 'react'; | ||
|
||
import { | ||
Container, | ||
FlexContainer, | ||
InputContainer, | ||
} from './BlockchainSelectorButton.styles'; | ||
|
||
export function BlockchainSelectorButton(props: PropTypes) { | ||
const { onClick, value, title, hasLogo, placeholder, disabled } = props; | ||
|
||
return ( | ||
<Container> | ||
<Typography size="large" variant="label"> | ||
{title} | ||
</Typography> | ||
<Divider size={10} /> | ||
<InputContainer | ||
onClick={disabled ? undefined : onClick} | ||
disabled={disabled}> | ||
<FlexContainer> | ||
{hasLogo && ( | ||
<> | ||
<Image | ||
src={value?.logo} | ||
size={16} | ||
useAsPlaceholder={!value?.logo} | ||
type="circular" | ||
/> | ||
<Divider size={4} direction="horizontal" /> | ||
</> | ||
)} | ||
<Typography | ||
className="title_typography" | ||
size="medium" | ||
variant="label"> | ||
{value?.name || placeholder} | ||
</Typography> | ||
</FlexContainer> | ||
<ChevronRightIcon size={12} color="black" /> | ||
</InputContainer> | ||
</Container> | ||
); | ||
} |
11 changes: 11 additions & 0 deletions
11
widget/embedded/src/components/BlockchainSelectorButton/BlockchainSelectorButton.types.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
export interface PropTypes { | ||
onClick: () => void; | ||
value?: { | ||
name: string; | ||
logo: string; | ||
}; | ||
title: string; | ||
placeholder: string; | ||
hasLogo?: boolean; | ||
disabled?: boolean; | ||
} |
1 change: 1 addition & 0 deletions
1
widget/embedded/src/components/BlockchainSelectorButton/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { BlockchainSelectorButton } from './BlockchainSelectorButton'; |
10 changes: 0 additions & 10 deletions
10
widget/embedded/src/components/ConfirmWalletsModal/ConfirmWallets.helpers.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
widget/embedded/src/components/CustomTokenModal/CustomTokenModal.helpers.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import type { BlockchainMeta } from 'rango-types'; | ||
|
||
export function generateExplorerLink( | ||
address: string | null, | ||
blockchain: BlockchainMeta | ||
): string { | ||
// We don't have Cosmos explorer url in API. | ||
if (blockchain.type === 'COSMOS') { | ||
return ''; | ||
} | ||
|
||
const explorerLinkPattern = blockchain.info?.addressUrl; | ||
|
||
if (!explorerLinkPattern || !address) { | ||
return ''; | ||
} | ||
|
||
return explorerLinkPattern.replace('{wallet}', address); | ||
} |
57 changes: 57 additions & 0 deletions
57
widget/embedded/src/components/CustomTokenModal/CustomTokenModal.styles.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import { darkTheme, styled } from '@rango-dev/ui'; | ||
|
||
export const StyledLink = styled('a', { | ||
textDecoration: 'none', | ||
color: '$colors$neutral700', | ||
[`.${darkTheme} &`]: { | ||
color: '$colors$neutral900', | ||
}, | ||
|
||
'& svg': { | ||
marginLeft: '$4', | ||
color: '$colors$neutral700', | ||
[`.${darkTheme} &`]: { | ||
color: '$colors$neutral900', | ||
}, | ||
}, | ||
|
||
variants: { | ||
hasHover: { | ||
true: { | ||
'&:hover': { | ||
color: '$colors$secondary550', | ||
[`.${darkTheme} &`]: { | ||
color: '$colors$secondary500', | ||
}, | ||
'& svg': { | ||
color: '$colors$secondary550', | ||
[`.${darkTheme} &`]: { | ||
color: '$colors$secondary500', | ||
}, | ||
}, | ||
}, | ||
}, | ||
false: {}, | ||
}, | ||
}, | ||
}); | ||
|
||
export const Container = styled('div', { | ||
display: 'flex', | ||
justifyContent: 'center', | ||
flexDirection: 'column', | ||
alignItems: 'center', | ||
textAlign: 'center', | ||
'& ._blockchain-name, & ._coin-source': { | ||
color: '$colors$neutral600', | ||
[`.${darkTheme} &`]: { | ||
color: '$colors$neutral800', | ||
}, | ||
}, | ||
'& ._coin-source-name, & ._custom-token-description': { | ||
color: '$colors$neutral700', | ||
[`.${darkTheme} &`]: { | ||
color: '$colors$neutral900', | ||
}, | ||
}, | ||
}); |
Oops, something went wrong.