-
Notifications
You must be signed in to change notification settings - Fork 6
Add listeners and attributes to tooltips #118
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,43 +1,31 @@ | ||
| import centered from '@storybook/addon-centered/react'; | ||
| import { storiesOf } from '@storybook/react'; | ||
| import React, { useState } from 'react'; | ||
|
|
||
| import Select from '../Select'; | ||
| import React from 'react'; | ||
| import { action } from '@storybook/addon-actions'; | ||
| import { select, text } from '@storybook/addon-knobs/react'; | ||
| import Tooltip from '../Tooltip'; | ||
| import { POSITIONS } from '../constants'; | ||
|
|
||
| const id = 'tooltipDemo'; | ||
|
|
||
| storiesOf('Tooltip', module) | ||
| .addDecorator(centered) | ||
| .add('All Knobs', () => { | ||
| const [position, setPosition] = useState('top-left'); | ||
|
|
||
| const handleChange = ({ target: { value } }) => { | ||
| setPosition(value); | ||
| }; | ||
| let position = select('positions', POSITIONS, 'top-left'); | ||
| let content = text('content', 'I am a tool tip'); | ||
|
|
||
| return ( | ||
| <div> | ||
| <> | ||
| <hx-icon id={id} type="help-circle" /> | ||
| <Tooltip id={id} position={position}> | ||
| Some Message | ||
| <Tooltip | ||
| id={id} | ||
| position={position} | ||
| onOpen={action('onOpen')} | ||
| onClose={action('onClose')} | ||
| onReposition={action('onReposition')} | ||
| > | ||
| {content} | ||
| </Tooltip> | ||
| <div style={{ marginTop: 100, width: 300 }}> | ||
| <Select id="selectTooltipDemo" label="Position" onChange={handleChange}> | ||
| <option value="top-left">Top Left</option> | ||
| <option value="top-center">Top Center</option> | ||
| <option value="top-right">Top Right</option> | ||
| <option value="right-top">Right Top</option> | ||
| <option value="right-middle">Right Middle</option> | ||
| <option value="right-bottom">Right Bottom</option> | ||
| <option value="bottom-right">Bottom Right</option> | ||
| <option value="bottom-center">Bottom Center</option> | ||
| <option value="bottom-left">Bottom Left</option> | ||
| <option value="left-bottom">Left Bottom</option> | ||
| <option value="left-middle">Left Middle</option> | ||
| <option value="left-top">Left Top</option> | ||
| </Select> | ||
| </div> | ||
| </div> | ||
| </> | ||
| ); | ||
| }); | ||
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.
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.
Is this different from https://github.com/HelixDesignSystem/helix-react/pull/116/files#r508772386?
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.
Yep they are different, tooltips do not seem to suffer from the same issues as Alerts. The other difference is this is a storybook story and not a wrapper. Issue seems to popup when the wrappers top level HTML node gets unexpectedly removed by helix.
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.
Ok thanks for the explanation here also. 🙂