Skip to content
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

Conversation

spburtsev
Copy link
Contributor

@spburtsev spburtsev commented Jan 15, 2024

Breaking change : Use Button component in HeaderGlobalAction

** Issue: #1893

** Edit: an example of updated HeaderGlobalAction

image

ref?: null | HTMLButtonElement;

[key: `data-${string}`]: any;
ref?: undefined;
Copy link
Contributor Author

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?

Copy link
Contributor

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.

Copy link
Contributor Author

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

@spburtsev spburtsev changed the title Use carbon button for header action global Use Button component for HeaderGlobalAction Jan 15, 2024
<svelte:component this="{icon}" size="{20}" />
</slot>
</button>
<Button bind:this="{ref}" class="{buttonClass}" {...$$restProps} on:click>
Copy link
Contributor

@brunnerh brunnerh Jan 15, 2024

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.

Copy link
Contributor Author

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.

@metonym metonym self-assigned this Feb 11, 2024
@metonym metonym force-pushed the use-carbon-button-for-header-action-global branch from e6e922f to ce3dd9f Compare February 24, 2024 22:16
@metonym metonym changed the title Use Button component for HeaderGlobalAction feat(header-global-action): support button tooltips Feb 24, 2024
Copy link
Collaborator

@metonym metonym left a 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.

@metonym metonym changed the title feat(header-global-action): support button tooltips feat(ui-shell): support button tooltip in HeaderGlobalAction Mar 8, 2024
@metonym metonym merged commit d8bc651 into carbon-design-system:master Mar 8, 2024
1 check passed
@metonym
Copy link
Collaborator

metonym commented Mar 8, 2024

Released in v0.84.0. Thanks again to both of you – really great to see.

Example in docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants