Skip to content

Instantly share code, notes, and snippets.

@aalmada
Last active December 14, 2022 14:42
Show Gist options
  • Save aalmada/40d41b05d07bee03cb092fb1ed87edd1 to your computer and use it in GitHub Desktop.
Save aalmada/40d41b05d07bee03cb092fb1ed87edd1 to your computer and use it in GitHub Desktop.
Customizing RainbowKit to use jazzicon avatars. Uses the Jazzicon component shared on previous gist.
import { AvatarComponent } from "@rainbow-me/rainbowkit";
import Jazzicon from "./Jazzicon";
import { addressToSeed } from "./utils";
const JazziconAvatar: AvatarComponent = ({ address, ensImage, size }) =>
ensImage ? (
<img
src={ensImage}
width={size}
height={size}
style={{ borderRadius: 999 }}
alt=""
/>
) : (
<Jazzicon
seed={addressToSeed(address as `0x${string}`)}
width={size}
height={size}
/>
);
export default JazziconAvatar;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment