-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
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
[AvatarGroup] Introduce new component #18707
Conversation
69e8ced
to
5cbdb9d
Compare
@material-ui/lab: parsed: +0.44% , gzip: +0.21% Details of bundle changes.Comparing: a973b2f...8a64ad8
|
27709a7
to
5b3c1c9
Compare
/** | ||
* The avatars to stack. | ||
*/ | ||
children: React.ReactNode; |
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.
A ReactNode
can be undefined, should probably be ReactElement
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.
Would it work after React.Children.toArray(undefined)
?
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.
Oh or just?
children?: React.ReactNode;
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 had a look at the codebase, we don't have much consistency on this point.
Nice job so far. Looking at the benchmarks, Atlas and Treasury both allow passing in the data, and generate the required Avatars. While we've generally favoured composed components, that could be nice as an option. Chakra (or whoever's code they copied) supports the ability to set the max number of avatars before truncation - that seems like a nice thing to automate. (It helps that their Avatar also has a name prop.). Also, the prop to adjust the negative margin might have some merit. Other than that, it looks pretty clean! |
@mbrookes Thanks for the review, I have wondered about these points.
|
That was what I had in mind.
Sure, everything can be done by the developer, but then, why use the component? I'm not wedded to this, but it seems like it might have some value.
I was thinking more of a limited set of values, each with their own class. |
To be honest, I don't know. I'm not sure how people will use this component. The nice thing about your proposal is that they are incremental, we should be able to add them later down the road when we see a compelling reason to do so. |
5b3fb6b
to
69aeb1f
Compare
69aeb1f
to
2b9490e
Compare
2b9490e
to
8a64ad8
Compare
Awesome work!! |
Thanks for this! |
Closes #17611.
Benchmark