Skip to content

Commit

Permalink
PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
chandlerprall committed Jul 12, 2018
1 parent 697ab58 commit eadb5c6
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {

import {
EuiCode,
EuiLink,
EuiMutationObserver,
} from '../../../../src/components';

Expand All @@ -28,8 +29,11 @@ export const MutationObserverExample = {
}],
text: (
<p>
<EuiCode>MutationObserver</EuiCode> is a wrapper around the Mutation Observer API.
It takes the same configuration object describing what to watch for and fires the
<EuiCode>MutationObserver</EuiCode> is a wrapper around the
<EuiLink href="https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver"> Mutation Observer API </EuiLink>
which allows watching for DOM changes to elements and their children.
<EuiCode>MutationObserver</EuiCode> takes the same configuration object
as the browser API to describe what to watch for, and fires the
callback when that mutation happens.
</p>
),
Expand Down
4 changes: 2 additions & 2 deletions src-docs/src/views/popover/popover_example.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ const popoverHTMLElementAnchorSource = require('!!raw-loader!./popover_htmleleme
const popoverHTMLElementAnchorHtml = renderToHtml(PopoverHTMLElementAnchor);

import PopoverContainer from './popover_container';
const popoverContainerSource = require('!!raw-loader!./popover_htmlelement_anchor');
const popoverContainerHtml = renderToHtml(PopoverHTMLElementAnchor);
const popoverContainerSource = require('!!raw-loader!./popover_container');
const popoverContainerHtml = renderToHtml(PopoverContainer);


export const PopoverExample = {
Expand Down
21 changes: 15 additions & 6 deletions src-docs/src/views/portal/portal_example.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,22 @@ export const PortalExample = {
code: portalInsertHtml,
}],
text: (
<p>
There is an optional <EuiCode>insert</EuiCode> prop that can specify the portal&quot;s
location in the DOM. When used, it is important to consider how the location relates
to the component lifecycle, as it could be removed from the DOM by another component
update.
</p>
<React.Fragment>
<p>
There is an optional <EuiCode>insert</EuiCode> prop that can specify the portal&apos;s
location in the DOM. When used, it is important to consider how the location relates
to the component lifecycle, as it could be removed from the DOM by another component
update.
</p>
<p>
<EuiCode>insert</EuiCode> is an object with two key/values: <EuiCode>sibling</EuiCode>
and <EuiCode>position</EuiCode>. sibling is either the React node or HTMLElement
the portal should be inserted next to, and position specifies the portals relative
position, either <EuiCode>before</EuiCode> or <EuiCode>after</EuiCode>.
</p>
</React.Fragment>
),
props: { EuiPortal },
demo: <PortalInsert />,
}],
};
4 changes: 2 additions & 2 deletions src-docs/src/views/portal/portal_insert.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ export class PortalInsert extends Component {
};
}

setButtonRef = node => this.buttonRef = node
setButtonRef = node => this.buttonRef = node;

togglePortal = () => {
this.setState(prevState => ({ isPortalVisible: !prevState.isPortalVisible }));
}
};

render() {

Expand Down
5 changes: 3 additions & 2 deletions src/components/portal/portal.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,13 @@ export class EuiPortal extends Component {

EuiPortal.propTypes = {
children: PropTypes.node,
/** `{sibling: ReactNode|HTMLElement, position: 'before'|'after'}` */
insert: PropTypes.shape({
sibling: PropTypes.oneOfType([
PropTypes.node,
PropTypes.instanceOf(HTMLElement)
]).isRequired,
position: PropTypes.oneOf(INSERT_POSITIONS),
portalRef: PropTypes.func,
})
}),
portalRef: PropTypes.func,
};

0 comments on commit eadb5c6

Please sign in to comment.