Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
add EuiListGroup and EuiListGroupItem type definitions. #1737
add EuiListGroup and EuiListGroupItem type definitions. #1737
Changes from 4 commits
0a61f9f
df7f4e9
315d605
af90e00
64f9e6f
4a648e2
5ac2845
3490cee
0cfd614
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
One last thing. Just got lost in the shuffle:
onClick?: MouseEventHandler<HTMLButtonElement>
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 in 3490cee.
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.
Similar to
EuiListGroupProps
we need to account for prop...
spread onto HTML elements. This component is more complex, though, as its props can potentially be spread onto 3 different elements. So we need something like the following:Which can then be used like:
@chandlerprall would be a helpful second set of eyes here.
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.
Instead of passing
EuiListGroupItemProps
through a generic type variable, cleaner to mix it directly intoEuiListGroupItemElement
-@thompsongl did you test that union out to ensure it resolves correctly?
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.
Hmm actually appears that it'll allow passing attributes from both
HTMLButtonElement
andHTMLAnchorElement
. For instance, it's fine with both:Seems like
EuiButtonPropsForButtonOrLink
would have the same problemThere 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.
In 64f9e6f I pushed:
Let me know what you think about it. Another question about this: Now that
onClick
andhref
are part of the union typeEuiListGroupItemExtendedProps
, can those attributes be removed from the originalEuiListGroupItemProps
?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.
Does it work with
ExclusiveUnion<>
?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.
This appears to work:
Do we need a thing that accepts more than 2 types?
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 added a version using ExclusiveUnion in 4a648e2.
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.
As long as the autodocs parses this acceptably, I kinda like making it ugly to list multiple version here - it matches the overhead that it pushes down the consuming dev when considering how to use the component. Don't make sub-optimal component design easy :)
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.
💯
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.
Can you also just double-check that none of these changes affect the EuiNavDrawer and specifically the EuiNavDrawerGroup:
eui/src/components/nav_drawer/nav_drawer_group.js
Lines 51 to 58 in 90240a0
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.
Thanks for pointing that out! I now tested it using
yarn start-test-server
andpropTypes
pass for theEuiListGroup
andEuiNavDrawer
examples - for testing I also temporarily added another required fake prop which then triggered an error forNavDrawer
.