mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
move Blockies into separate component
This commit is contained in:
parent
f8ffcbac75
commit
b30fcf0c4b
8
src/components/atoms/Blockies.module.css
Normal file
8
src/components/atoms/Blockies.module.css
Normal file
@ -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;
|
||||
}
|
23
src/components/atoms/Blockies.tsx
Normal file
23
src/components/atoms/Blockies.tsx
Normal file
@ -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 (
|
||||
<img
|
||||
className={`${styles.blockies} ${className || ''}`}
|
||||
src={blockies}
|
||||
alt="Blockies"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
)
|
||||
}
|
@ -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) {
|
||||
|
@ -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 (
|
||||
<img
|
||||
className={styles.blockies}
|
||||
src={blockies}
|
||||
alt="Blockies"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
)
|
||||
}
|
||||
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()}
|
||||
>
|
||||
<Blockies account={accountId} />
|
||||
<Blockies accountId={accountId} />
|
||||
<span className={styles.address} title={accountId}>
|
||||
{accountTruncate(accountId)}
|
||||
</span>
|
||||
|
@ -16,9 +16,13 @@
|
||||
}
|
||||
}
|
||||
|
||||
.imageWrap {
|
||||
.imageWrap,
|
||||
.image {
|
||||
width: 96px;
|
||||
height: 96px;
|
||||
}
|
||||
|
||||
.imageWrap {
|
||||
border-radius: 50%;
|
||||
overflow: hidden;
|
||||
margin-bottom: calc(var(--spacer) / 4);
|
||||
|
@ -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 (
|
||||
<img
|
||||
className={styles.image}
|
||||
src={blockies}
|
||||
alt="Blockies"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
)
|
||||
}
|
||||
import Blockies from '../../atoms/Blockies'
|
||||
|
||||
export default function Account({
|
||||
name,
|
||||
@ -40,7 +25,7 @@ export default function Account({
|
||||
{image ? (
|
||||
<img src={image} className={styles.image} width="96" height="96" />
|
||||
) : accountId ? (
|
||||
<Blockies account={accountId} />
|
||||
<Blockies accountId={accountId} className={styles.image} />
|
||||
) : (
|
||||
<img
|
||||
src={jellyfish}
|
||||
|
Loading…
Reference in New Issue
Block a user