-
-
Notifications
You must be signed in to change notification settings - Fork 262
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
feat(ui-shell): support button tooltip in HeaderGlobalAction
#1894
feat(ui-shell): support button tooltip in HeaderGlobalAction
#1894
Conversation
ref?: null | HTMLButtonElement; | ||
|
||
[key: `data-${string}`]: any; | ||
ref?: 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.
I am not sure why it was updated this way by yarn build:docs
. Should I edit this file manually?
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.
The binding probably should be updated if the button element should be exposed.
Right now the component instance is bound, i.e. change this:
- <Button bind:this="{ref}" class="{buttonClass}" {...$$restProps} on:click>
+ <Button bind:ref class="{buttonClass}" {...$$restProps} on:click>
Don't know if that would reinstate the type inference, though; if not, it should be possible to use @type
in the JSDoc of the property in the component. The generated files should not be touched.
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 applied this suggestion, but the .d.ts file did not update properly until I specified the type in JSDoc explicitly
<svelte:component this="{icon}" size="{20}" /> | ||
</slot> | ||
</button> | ||
<Button bind:this="{ref}" class="{buttonClass}" {...$$restProps} on:click> |
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.
The order of the properties matters and probably causes issues.
class:
directives work independently from a class
property passed in via $$restProps
.
But now that a component is used, I suspect that when a class
is set, the spread will overwrite what was set before to buttonClass
.
If that is the case, the spread should happen before setting class
or the component should define a class
property, so it no longer is part of $$restProps
.
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 did not find any differences depending on the order of these props, but just in case I put $$restProps before class.
e6e922f
to
ce3dd9f
Compare
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 appreciate the both of you for working on this! Tried it myself and it looks great.
I made a couple of changes:
- 6ef0f06: Also apply the refactored icon slot logic to the link button variant (I noticed locally that the icon failed to render for link buttons)
- 321813f: Tweak the Header Utilities example to include three
HeaderGlobalAction
components to demo and test out the various tooltip positions
I'll get this out in the next minor version release.
HeaderGlobalAction
Breaking change : Use Button component in HeaderGlobalAction
** Issue: #1893
** Edit: an example of updated HeaderGlobalAction