This repository was archived by the owner on Mar 4, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 51
feat(Popup): add 'target' prop #356
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
124d5fd
add 'target' prop
kuzhelov-ms 808674e
Merge branch 'master' into feat/popup-add-target-prop
kuzhelov b53f32f
Merge branch 'master' into feat/popup-add-target-prop
kuzhelov 227376a
update changelog
kuzhelov-ms c777daf
fix changelog
kuzhelov-ms 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
37 changes: 37 additions & 0 deletions
37
docs/src/examples/components/Popup/Types/PopupCustomTargetExample.shorthand.tsx
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 |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| import React from 'react' | ||
| import { Popup, Divider, Icon, Text, Grid } from '@stardust-ui/react' | ||
| import { findDOMNode } from 'react-dom' | ||
|
|
||
| class PopupExample extends React.Component { | ||
| ref = React.createRef<any>() | ||
| state = { popupTarget: undefined } | ||
|
|
||
| componentDidMount() { | ||
| this.setState({ popupTarget: findDOMNode(this.ref.current) }) | ||
| } | ||
|
|
||
| render() { | ||
| return ( | ||
| <Grid columns="auto 1fr"> | ||
| {/* CUSTOM DOM ELEMENT is used as target for Popup */} | ||
| <Popup | ||
| target={this.state.popupTarget} | ||
| trigger={<Icon name="question" circular bordered styles={{ cursor: 'pointer' }} />} | ||
| content="well, yes, I am just a garbish text ¯\_(ツ)_/¯" | ||
| position="below" | ||
| /> | ||
|
|
||
| <div style={{ marginLeft: 10 }}> | ||
| <Text>Could you guess what does this text means? :)</Text> | ||
| <Divider /> | ||
| <Text ref={this.ref}> | ||
| "To the lascivious looking-glass I, that love's majesty to strut before a want love's | ||
| majesto, to the souls of York." | ||
| </Text> | ||
| </div> | ||
| </Grid> | ||
| ) | ||
| } | ||
| } | ||
|
|
||
| export default PopupExample |
38 changes: 38 additions & 0 deletions
38
docs/src/examples/components/Popup/Types/PopupCustomTargetExample.tsx
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 |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| import React from 'react' | ||
| import { Popup, Divider, Icon, Text, Grid } from '@stardust-ui/react' | ||
| import { findDOMNode } from 'react-dom' | ||
|
|
||
| class PopupExample extends React.Component { | ||
| ref = React.createRef<any>() | ||
| state = { popupTarget: undefined } | ||
|
|
||
| componentDidMount() { | ||
| this.setState({ popupTarget: findDOMNode(this.ref.current) }) | ||
| } | ||
|
|
||
| render() { | ||
| return ( | ||
| <Grid columns="auto 1fr"> | ||
| {/* CUSTOM DOM ELEMENT is used as target for Popup */} | ||
| <Popup | ||
| target={this.state.popupTarget} | ||
| content="well, yes, I am just a garbish text ¯\_(ツ)_/¯" | ||
| position="below" | ||
| > | ||
| <Icon name="question" circular bordered styles={{ cursor: 'pointer' }} /> | ||
| </Popup> | ||
|
|
||
| <div style={{ marginLeft: 10 }}> | ||
| <Text>Could you guess what does this text means? :)</Text> | ||
| <Divider /> | ||
| <Text ref={this.ref}> | ||
| "To the lascivious looking-glass I, that love's majesty to strut before a want love's | ||
| majesto, to the souls of York." | ||
| </Text> | ||
| </div> | ||
| </Grid> | ||
| ) | ||
| } | ||
| } | ||
|
|
||
| export default PopupExample |
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
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
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.
why is this necessary?
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.
otherwise, in case if
childrenis not provided for the component, this will throw the error and fails rendering process for the whole tree - while, in contrast, if we will handle it this way, then forinnerRefcallbacknullwill be validly provided as captured DOM element (as there are no elements rendered)