diff --git a/src/components/atoms/Blockies.module.css b/src/components/atoms/Blockies.module.css new file mode 100644 index 000000000..928123b18 --- /dev/null +++ b/src/components/atoms/Blockies.module.css @@ -0,0 +1,8 @@ +.blockies { + width: var(--font-size-large); + height: var(--font-size-large); + border-radius: 50%; + overflow: hidden; + display: inline-block; + vertical-align: middle; +} diff --git a/src/components/atoms/Blockies.tsx b/src/components/atoms/Blockies.tsx new file mode 100644 index 000000000..4a02becbe --- /dev/null +++ b/src/components/atoms/Blockies.tsx @@ -0,0 +1,23 @@ +import { toDataUrl } from 'ethereum-blockies' +import React, { ReactElement } from 'react' +import styles from './Blockies.module.css' + +export default function Blockies({ + accountId, + className +}: { + accountId: string + className?: string +}): ReactElement { + if (!accountId) return null + const blockies = toDataUrl(accountId) + + return ( + + ) +} diff --git a/src/components/molecules/Wallet/Account.module.css b/src/components/molecules/Wallet/Account.module.css index 0a4d0d6be..1dbce49f8 100644 --- a/src/components/molecules/Wallet/Account.module.css +++ b/src/components/molecules/Wallet/Account.module.css @@ -41,20 +41,12 @@ } } -.blockies { - width: var(--font-size-large); - height: var(--font-size-large); - border-radius: 50%; - overflow: hidden; - display: inline-block; - vertical-align: middle; -} - .address { display: none; text-transform: none; border-right: 1px solid var(--border-color); padding-right: calc(var(--spacer) / 3); + padding-left: calc(var(--spacer) / 8); } @media screen and (min-width: 60rem) { diff --git a/src/components/molecules/Wallet/Account.tsx b/src/components/molecules/Wallet/Account.tsx index 7b3be33fc..22c2ad249 100644 --- a/src/components/molecules/Wallet/Account.tsx +++ b/src/components/molecules/Wallet/Account.tsx @@ -1,24 +1,10 @@ -import { toDataUrl } from 'ethereum-blockies' import React, { FormEvent } from 'react' import { ReactComponent as Caret } from '../../../images/caret.svg' import { accountTruncate } from '../../../utils/web3' import Loader from '../../atoms/Loader' import styles from './Account.module.css' import { useWeb3 } from '../../../providers/Web3' - -const Blockies = ({ account }: { account: string | undefined }) => { - if (!account) return null - const blockies = toDataUrl(account) - - return ( - - ) -} +import Blockies from '../../atoms/Blockies' // Forward ref for Tippy.js // eslint-disable-next-line @@ -44,7 +30,7 @@ const Account = React.forwardRef((props, ref: any) => { ref={ref} onClick={(e) => e.preventDefault()} > - + {accountTruncate(accountId)} diff --git a/src/components/pages/Profile/Account.module.css b/src/components/pages/Profile/Account.module.css index 678f3c716..2c58d49ef 100644 --- a/src/components/pages/Profile/Account.module.css +++ b/src/components/pages/Profile/Account.module.css @@ -16,9 +16,13 @@ } } -.imageWrap { +.imageWrap, +.image { width: 96px; height: 96px; +} + +.imageWrap { border-radius: 50%; overflow: hidden; margin-bottom: calc(var(--spacer) / 4); diff --git a/src/components/pages/Profile/Account.tsx b/src/components/pages/Profile/Account.tsx index 91bfccb6a..8c68ac039 100644 --- a/src/components/pages/Profile/Account.tsx +++ b/src/components/pages/Profile/Account.tsx @@ -1,4 +1,3 @@ -import { toDataUrl } from 'ethereum-blockies' import React, { ReactElement } from 'react' import { useUserPreferences } from '../../../providers/UserPreferences' import { accountTruncate } from '../../../utils/web3' @@ -7,21 +6,7 @@ import NetworkName from '../../atoms/NetworkName' import jellyfish from '@oceanprotocol/art/creatures/jellyfish/jellyfish-grid.svg' import styles from './Account.module.css' import Copy from '../../atoms/Copy' - -const Blockies = ({ account }: { account: string | undefined }) => { - if (!account) return null - - const blockies = toDataUrl(account) - - return ( - - ) -} +import Blockies from '../../atoms/Blockies' export default function Account({ name, @@ -40,7 +25,7 @@ export default function Account({ {image ? ( ) : accountId ? ( - + ) : (