Skip to content

srkanyalcinkaya/react-chavinci-avatar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

2 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Statements Branches Functions Lines
Statements Branches Functions Lines

react-chavinci-avatar

๐Ÿคก A React component for rendering Chavinci avatars based on account address

Overview ๐Ÿง

The ChavinciAvatar component is a React functional component that takes in a required address property of type string and an optional size property of type number. It returns an image avatar of the given Ethereum address provided as a string and renders it within an AvatarWrapper component, which can be styled using the className property.

Installation ๐Ÿ“ฆ

npm

npm install react-chavinci-avatar

yarn

yarn add react-chavinci-avatar

Demo

Hosted storybook

Props

address

The required address property is a string of length 42 that represents an Ethereum address. If it is not provided or does not meet the expected length, the component returns null.

size

The optional size property is a number that sets the size of the avatar image in pixels. If not provided, it defaults to 24.

className

The optional className property is a string that allows for custom styling using the AvatarWrapper component. It will be added to the className prop of the AvatarWrapper component.

Usage ๐Ÿ“š

import React from 'react';
import { ChavinciAvatar } from 'react-chavinci-avatar';

export const App: React.FunctionComponent = () => {
    return (
        <ChavinciAvatar address="0xb01F14d1C9000D453241221EB54648F1C378c970" size={24} />
    )
}

FAQ

I want to add custom styling. How can I do that?

Under the hood react-chavinci-avatar uses @emotion/styled. Therefore, following a guide for custom styling emotion elements is the way to go.

Example:

import React from 'react';
import { ChavinciAvatar } from 'react-chavinci-avatar';

const SquareChavinciAvatar = styled(ChavinciAvatar)`
    border-radius: none;
`;

export const App: React.FunctionComponent = () => {
    return (
        <SquareChavinciAvatar address="0xb01F14d1C9000D453241221EB54648F1C378c970" size={24} />
    )
}

About

๐Ÿš€๐Ÿ“ฆ A React component for rendering Chavinci avatars based on account address

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published