ambassify / react-avatar

Universal avatar makes it possible to fetch/generate an avatar based on the information you have about that user.
MIT License
643 stars 117 forks source link

Make "title" nullable #216

Closed radenkovic closed 2 years ago

radenkovic commented 3 years ago

custom tooltip I've issued a problem where I use custom tooltip over the avatar (react-tooltip), but I cannot set title={false}. It works but propTypes is showing warnings. This PR should allow to set title={false} in case you want to use custom tooltip

JorgenEvens commented 3 years ago

Hi @radenkovic ,

How would this actually differ from passing null? This, from the top of my head, should be fine for propType validation.

radenkovic commented 3 years ago

@JorgenEvens sorry for delayed response! Actually null passes propTypes validation, but it requires more a bit work (even without my PR, so when set to false).

You can see here:

title={title || name || value}

That even when title is null or false, it will fallback to name or value...

We can add something like

let avatarTitle = title || name || value
if (title === null) avatarTitle = null
// ....

<Avatar title={avatarTitle} />
davidkhierl commented 3 years ago

image

Same scenario, it would be great to disable the tooltip

tyzion commented 2 years ago

Please add this feature Or one similar, like title={hideTitle ? null : (title || name || value)}

JorgenEvens commented 2 years ago

This has been fixed in the 5.0.0 release of react-avatar.

@radenkovic Thank you for your contribution!