-
Notifications
You must be signed in to change notification settings - Fork 7
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
Issue #783 #948
Merged
Merged
Issue #783 #948
Changes from 17 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
56e667c
Bumped react react-dom and html-react-parser version.
IanCStewart 5fb1761
Bumped react and react-dom version.
IanCStewart 745a649
Fixed all the tests. Fixes #930.
IanCStewart dfc238c
Merge branch 'v5.0.0' into issue-#930
IanCStewart 604d227
Added react-portal to portal pop-over element to bottom of root.
IanCStewart d1dde86
Added own portal component.
IanCStewart 4f16999
Deconstructed props.
IanCStewart e229d2d
Merge branch 'v5.0.0' into issue-#783
IanCStewart 0a59bdb
Added doc page about portal component. Fixes #783.
IanCStewart 031eba6
Added example for portal component.
IanCStewart 934c6e5
Added description for docs page.
IanCStewart 98dc8f7
Added description for docs page.
IanCStewart 5232a41
Added alert about react v16.
IanCStewart ba9869c
Made passthrough for portal node prop instead.
IanCStewart 48690c0
Fixed Selects positioning.
IanCStewart 47fffc4
Fixed pop-over-position test.
IanCStewart fafbb62
DocGen.
IanCStewart c99f8ed
Adjusted in favor of comments.
IanCStewart 948b30b
Merge branch 'v5.0.0' into issue-#783
IanCStewart a19be8a
Fixed broken check.
IanCStewart cd1433e
Changed example.
27614e7
Changed text.
8d78b6b
Cleanup.
016069b
Docgen.
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 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,8 @@ | ||
{ | ||
"reporter": [ | ||
"text" | ||
], | ||
"exclude": [ | ||
"test/**/*" | ||
] | ||
} |
This file contains 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 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 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 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 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 @@ | ||
export default ` | ||
\`\`\`jsx | ||
import React, { Component } from 'react'; | ||
import Portal from 'anchor-ui/portal'; | ||
|
||
class MyComponent extends Component { | ||
state = { | ||
portalOpen: false | ||
} | ||
|
||
togglePortal = () => { | ||
const { portalOpen } = this.state; | ||
|
||
this.setState({ | ||
portalOpen: !portalOpen | ||
}); | ||
} | ||
|
||
render() { | ||
const { portalOpen } = this.state; | ||
|
||
return ( | ||
<section> | ||
<Button onClick={this.togglePortal}>Portal</Button> | ||
{ | ||
portalOpen | ||
? <Portal node={document.getElementById('root')}> | ||
// children to be portaled | ||
</Portal> | ||
:null | ||
} | ||
</section> | ||
); | ||
} | ||
} | ||
\`\`\` | ||
`; |
This file contains 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,78 @@ | ||
/* global document */ | ||
import React from 'react'; | ||
import _ from 'lodash'; | ||
import IconRocket from '../../../../dist/icons/icon-rocket'; | ||
import Button from '../../../../dist/button'; | ||
import Portal from '../../../../dist/portal'; | ||
import Alert from '../../../../dist/alert'; | ||
import Props from '../props'; | ||
import components from '../../../components.json'; | ||
import Paper from '../../../../dist/paper'; | ||
import example from './example'; | ||
import Markdown from '../markdown'; | ||
|
||
class PortalDoc extends React.Component { | ||
constructor() { | ||
super(); | ||
|
||
this.state = { | ||
portal: false | ||
}; | ||
} | ||
|
||
togglePortal = () => { | ||
const { portal } = this.state; | ||
|
||
this.setState({ | ||
portal: !portal | ||
}); | ||
} | ||
|
||
render() { | ||
const { portal } = this.state; | ||
const componentData = _.find(components, component => component.displayName === 'Portal'); | ||
const style = { | ||
paper: { | ||
margin: 0, | ||
padding: '20px' | ||
}, | ||
button: { margin: '10px' }, | ||
alert: { maxWidth: '100%' } | ||
}; | ||
|
||
return ( | ||
<article className="page"> | ||
<h1>Portal</h1> | ||
<Alert | ||
style={style.alert} | ||
text="Portal will only transport elements to desired element in React v16 or later. If React isn't at v16 it will render the element where it's called." | ||
type="warning" | ||
/> | ||
<section> | ||
<h1>Description</h1> | ||
<p>{componentData.description}</p> | ||
</section> | ||
<section> | ||
<h1>Examples</h1> | ||
<Markdown markdown={example} title="Code example" /> | ||
<Paper style={style.paper} id="portal-container"> | ||
<h2>{portal ? 'Remove the Portal' : 'Add a Portal'}</h2> | ||
<Button onClick={this.togglePortal} style={style.button} iconButton> | ||
<IconRocket /> | ||
</Button> | ||
{ | ||
portal | ||
? <Portal node={document.getElementById('portal-container')}> | ||
<div>I got portaled to the bottom of this section!</div> | ||
</Portal> | ||
: null | ||
} | ||
</Paper> | ||
</section> | ||
<Props props={componentData.props} /> | ||
</article> | ||
); | ||
} | ||
} | ||
|
||
export default PortalDoc; |
This file contains 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 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 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,4 @@ | ||
const Adapter = require('enzyme-adapter-react-16'); | ||
const enzyme = require('enzyme'); | ||
|
||
enzyme.configure({ adapter: new Adapter() }); |
This file contains 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,2 @@ | ||
--require ./mocha-setup | ||
--compilers js:babel-core/register |
This file contains 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
Oops, something went wrong.
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.
Please remove this comment, document isn't used in this file