mirror of
https://github.com/pezkuwichain/pezkuwi-ui.git
synced 2026-08-05 21:55:46 +00:00
30 lines
712 B
TypeScript
30 lines
712 B
TypeScript
// Copyright 2017-2021 @polkadot/react-identicon authors & contributors
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
import type { Props } from '../types';
|
|
|
|
import React, { useCallback } from 'react';
|
|
|
|
import { beachballIcon } from '@polkadot/ui-shared';
|
|
|
|
function Identicon ({ address, className = '', size, style }: Props): React.ReactElement<Props> {
|
|
const updateElem = useCallback(
|
|
(node: HTMLDivElement): void => {
|
|
node && node.appendChild(
|
|
beachballIcon(address, { isAlternative: false, size })
|
|
);
|
|
},
|
|
[address, size]
|
|
);
|
|
|
|
return (
|
|
<div
|
|
className={className}
|
|
ref={updateElem}
|
|
style={style}
|
|
/>
|
|
);
|
|
}
|
|
|
|
export const Beachball = React.memo(Identicon);
|