-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
It would be great if the component could inform its parent about what color it is, very useful for use-cases like this: digitalungdom-se/digitalungdom.se#125
I think it should work like this:
import { useState } from 'react';
import HashedBotIdenticon from '@digitalungdom/bot-identicon';
function Example() {
const [color, setColor] = useState();
return <HashedBotIdenticon identifier="Ada Lovelace" setColor={setColor}>;
}I tried to implement it, However, I'm not used to writing typescript at all and I don't seem to be able to test if my code works in my local env. However, something along these lines might work:
...
export interface HashedBotIdenticonProps extends BotIdenticonProps {
identifier?: string | number,
setColor?: (color: [number, number, number] | undefined) => null,
}
export function HashedBotIdenticon({
identifier,
face,
color,
setColor,
...props
}: HashedBotIdenticonProps) {
let hashedColor: [number, number, number] | undefined = color
if (setColor != undefined) setColor(hashedColor)
...Metadata
Metadata
Assignees
Labels
No labels