fix(identicon): fix wrapper border-radius (#5144)
* fix(identicon): fix wrapper border-radius * pr feedback
This commit is contained in:
parent
491ae578ab
commit
d016bdd87c
@ -1,13 +1,13 @@
|
|||||||
import jazzicon from '@metamask/jazzicon'
|
import jazzicon from '@metamask/jazzicon'
|
||||||
import { useWeb3React } from '@web3-react/core'
|
import { useWeb3React } from '@web3-react/core'
|
||||||
import useENSAvatar from 'hooks/useENSAvatar'
|
import useENSAvatar from 'hooks/useENSAvatar'
|
||||||
import { useLayoutEffect, useMemo, useRef, useState } from 'react'
|
import { useCallback, useLayoutEffect, useMemo, useRef, useState } from 'react'
|
||||||
import styled from 'styled-components/macro'
|
import styled from 'styled-components/macro'
|
||||||
|
|
||||||
const StyledIdenticon = styled.div<{ iconSize: number }>`
|
const StyledIdenticon = styled.div<{ iconSize: number }>`
|
||||||
height: ${({ iconSize }) => `${iconSize}px`};
|
height: ${({ iconSize }) => `${iconSize}px`};
|
||||||
width: ${({ iconSize }) => `${iconSize}px`};
|
width: ${({ iconSize }) => `${iconSize}px`};
|
||||||
border-radius: 1.125rem;
|
border-radius: 50%;
|
||||||
background-color: ${({ theme }) => theme.deprecated_bg4};
|
background-color: ${({ theme }) => theme.deprecated_bg4};
|
||||||
font-size: initial;
|
font-size: initial;
|
||||||
`
|
`
|
||||||
@ -41,10 +41,12 @@ export default function Identicon({ size }: { size?: number }) {
|
|||||||
return
|
return
|
||||||
}, [icon, iconRef])
|
}, [icon, iconRef])
|
||||||
|
|
||||||
|
const handleError = useCallback(() => setFetchable(false), [])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<StyledIdenticon iconSize={iconSize}>
|
<StyledIdenticon iconSize={iconSize}>
|
||||||
{avatar && fetchable ? (
|
{avatar && fetchable ? (
|
||||||
<StyledAvatar alt="avatar" src={avatar} onError={() => setFetchable(false)}></StyledAvatar>
|
<StyledAvatar alt="avatar" src={avatar} onError={handleError}></StyledAvatar>
|
||||||
) : (
|
) : (
|
||||||
<span ref={iconRef} />
|
<span ref={iconRef} />
|
||||||
)}
|
)}
|
||||||
|
@ -17,7 +17,11 @@ export const ProfileAccountDetails = () => {
|
|||||||
setCopied(account ?? '')
|
setCopied(account ?? '')
|
||||||
}, [account, setCopied])
|
}, [account, setCopied])
|
||||||
|
|
||||||
return account ? (
|
if (!account) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
<Row className={headlineLarge} marginBottom="48" gap="4">
|
<Row className={headlineLarge} marginBottom="48" gap="4">
|
||||||
<Identicon size={60} />
|
<Identicon size={60} />
|
||||||
<Box textOverflow="ellipsis" overflow="hidden" marginLeft="8">
|
<Box textOverflow="ellipsis" overflow="hidden" marginLeft="8">
|
||||||
@ -36,5 +40,5 @@ export const ProfileAccountDetails = () => {
|
|||||||
</Box>
|
</Box>
|
||||||
</MouseoverTooltip>
|
</MouseoverTooltip>
|
||||||
</Row>
|
</Row>
|
||||||
) : null
|
)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user