-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add walletconnect icon badge to session avatars
- Loading branch information
1 parent
bac4e98
commit 0989e53
Showing
8 changed files
with
152 additions
and
51 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import { Avatar, Box, Flex } from '@chakra-ui/react'; | ||
import React, { FC } from 'react'; | ||
|
||
// components | ||
import WalletConnectIcon from '@extension/components/WalletConnectIcon'; | ||
|
||
interface IProps { | ||
iconUrl?: string; | ||
isWalletConnect?: boolean; | ||
name: string; | ||
size?: 'sm' | 'md'; | ||
} | ||
|
||
const SessionAvatar: FC<IProps> = ({ | ||
iconUrl, | ||
isWalletConnect = false, | ||
name, | ||
size = 'md', | ||
}: IProps) => { | ||
let walletConnectContainerSize: number = 5; | ||
let walletConnectIconSize: number = 4; | ||
|
||
switch (size) { | ||
case 'sm': | ||
walletConnectContainerSize = 4; | ||
walletConnectIconSize = 3; | ||
break; | ||
default: | ||
break; | ||
} | ||
|
||
return ( | ||
<Box position="relative" p={1}> | ||
{/*app icon */} | ||
<Avatar name={name} size={size} src={iconUrl} /> | ||
|
||
{/*walletconnect badge*/} | ||
{isWalletConnect && ( | ||
<Flex | ||
alignItems="center" | ||
bg="walletConnect.500" | ||
borderRadius="var(--chakra-radii-full)" | ||
bottom={0} | ||
h={walletConnectContainerSize} | ||
justifyContent="center" | ||
position="absolute" | ||
right={0} | ||
w={walletConnectContainerSize} | ||
> | ||
<WalletConnectIcon | ||
color="white" | ||
h={walletConnectIconSize} | ||
w={walletConnectIconSize} | ||
/> | ||
</Flex> | ||
)} | ||
</Box> | ||
); | ||
}; | ||
|
||
export default SessionAvatar; |
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 { default } from './SessionAvatar'; |
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
Oops, something went wrong.