mirror of
https://github.com/pezkuwichain/pezkuwi-ui.git
synced 2026-04-21 23:47:58 +00:00
d1cd13072f
- Updated all package references - Fixed react-identicon and related packages - Version 3.16.8
38 lines
800 B
TypeScript
38 lines
800 B
TypeScript
// Copyright 2017-2025 @pezkuwi/react-identicon authors & contributors
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
import type { Props } from '../types.js';
|
|
|
|
import makeBlockie from 'ethereum-blockies-base64';
|
|
import React, { useMemo } from 'react';
|
|
|
|
import { styled } from '../styled.js';
|
|
|
|
interface ImgProps {
|
|
size: number;
|
|
}
|
|
|
|
function Identicon ({ address, className = '', size, style = {} }: Props): React.ReactElement<Props> {
|
|
const imgSrc = useMemo(
|
|
() => makeBlockie(address),
|
|
[address]
|
|
);
|
|
|
|
return (
|
|
<StyledImg
|
|
className={className}
|
|
size={size}
|
|
src={imgSrc}
|
|
style={style}
|
|
/>
|
|
);
|
|
}
|
|
|
|
const StyledImg = styled.img<ImgProps>(({ size }) => `
|
|
display: block;
|
|
height: ${size}px;
|
|
width: ${size}px;
|
|
`);
|
|
|
|
export const Ethereum = React.memo(Identicon);
|