-
Notifications
You must be signed in to change notification settings - Fork 4.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
Add storybook story to the Tooltip component #20322
Conversation
Size Change: 0 B Total Size: 864 kB ℹ️ View Unchanged
|
const tooltipText = text( 'Text', 'More information' ); | ||
return ( | ||
<Tooltip text={ tooltipText }> | ||
<Button isSecondary>Hover for more information</Button> |
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 wonder if we should use a Button in the example or just some random div. The reason is the Button already supports a "tooltip" prop (and label) which should have the same behavior.
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.
Yeah, that makes sense, should I update the readme too? That's where I usually pull the examples from.
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.
Yes, why not
<Button isSecondary>Hover for more information</Button> | ||
</Tooltip> | ||
); | ||
}; |
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 you think it would be good to show multiple variations on the same story (top, left, right, bottom) like we do for the "buttons" story. Or we could use a knob for the position.
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.
Yeah, I started to do that but because storybook renders without any padding, changing the position didn't have any effect. I can add a wrapper element that positions the tooltip in the center, so you could see the difference?
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.
Sounds like a good plan to me.
89b5ca3
to
9fbd6b7
Compare
<Tooltip text={ tooltipText } position={ position }> | ||
<div | ||
style={ { | ||
margin: '100px', |
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.
Maybe more something like that
margin: '100px', | |
margin: '50px auto', | |
width: '200px', | |
padding: '20px' |
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.
Works for me, thanks
component: Tooltip, | ||
}; | ||
|
||
export const _default = () => { |
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.
Maybe we can just remove this one and just keep the "withPosition" one as default?
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.
No problem, updated
… have a tooltip prop with is the recommended was to add a tooltip to them.
89c560e
to
67ae82c
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.
Thanks 👍
Description
Add a story for the tooltip component
How has this been tested?
Run storybook and see the new tooltip option under the Components section
Screenshots
Types of changes
New feature (non-breaking change which adds functionality)
Checklist: