Commit d016bdd8 authored by Jordan Frankfurt's avatar Jordan Frankfurt Committed by GitHub

fix(identicon): fix wrapper border-radius (#5144)

* fix(identicon): fix wrapper border-radius

* pr feedback
parent 491ae578
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 }) { ...@@ -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 = () => { ...@@ -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 = () => { ...@@ -36,5 +40,5 @@ export const ProfileAccountDetails = () => {
</Box> </Box>
</MouseoverTooltip> </MouseoverTooltip>
</Row> </Row>
) : null )
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment