New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Grafana/ui: Add UserIcon and UsersIndicator components #66906
Conversation
* Output the initials of the first and last name (if given), capitalized and concatenated together. | ||
* If name is not provided, an empty string is returned. | ||
* @param {string} [name] The name to extract initials from. | ||
* @returns {string} The uppercase initials of the first and last name. | ||
* @example | ||
* // Returns 'JD' | ||
* getUserInitials('John Doe'); | ||
* // Returns 'A' | ||
* getUserInitials('Alice'); | ||
* // Returns '' | ||
* getUserInitials(); | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I love this!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice job on moving these 👍
just a couple of comments
} | ||
|
||
const limitReached = users.length > limit; | ||
const extraUsers = users.length - limit; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need a check here in case the limit
is negative? It doesn't make any sense but you can set it in storybook to -1, it ends up with a confusing result because then if there are 5 users the extraUsers are 6 so it displays 4 user icons and then +6 🙃
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done! Also added min
param to the argType but it looks like it doesn't apply to manually typed values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, lgtm! 👏
What is this feature?
Move the
UserIcon
andUsersIndicator
components into grafana/ui.Why do we need this feature?
Enable this component to be used by other parts of Grafana + plugins.
Which issue(s) does this PR fix?:
Part of #66679.
Special notes for your reviewer:
Default state:
Active state:
With many users
Please check that: