Skip to content

Commit

Permalink
Fix KuiPopover examples. (elastic#13461) (elastic#13469)
Browse files Browse the repository at this point in the history
  • Loading branch information
cjcenizal authored Aug 11, 2017
1 parent 52f78dc commit 1eb96a6
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 15 deletions.
41 changes: 27 additions & 14 deletions ui_framework/doc_site/src/views/popover/popover_anchor_position.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,32 @@ export default class extends Component {
super(props);

this.state = {
isPopoverOpen: false,
isPopoverOpen1: false,
isPopoverOpen2: false,
};
}

onButtonClick() {
onButtonClick1() {
this.setState({
isPopoverOpen: !this.state.isPopoverOpen,
isPopoverOpen1: !this.state.isPopoverOpen1,
});
}

closePopover() {
closePopover1() {
this.setState({
isPopoverOpen: false,
isPopoverOpen1: false,
});
}

onButtonClick2() {
this.setState({
isPopoverOpen2: !this.state.isPopoverOpen2,
});
}

closePopover2() {
this.setState({
isPopoverOpen2: false,
});
}

Expand All @@ -33,28 +46,28 @@ export default class extends Component {
<div>
<KuiPopover
button={(
<KuiButton buttonType="basic" onClick={ this.onButtonClick.bind(this) }>
<KuiButton buttonType="basic" onClick={ this.onButtonClick1.bind(this) }>
Popover anchored to the right.
</KuiButton>
)}
isOpen={ this.state.isPopoverOpen }
isOpen={this.state.isPopoverOpen1}
closePopover={this.closePopover1.bind(this)}
anchorPosition="right"
closePopover={ () => {} }
>
Popover content
</KuiPopover>

&nbsp;

<KuiPopover
button={ (
<KuiButton buttonType="basic" onClick={ this.onButtonClick.bind(this) }>
Popover anchored to the left.
button={(
<KuiButton buttonType="basic" onClick={ this.onButtonClick2.bind(this) }>
Popover anchored to the right.
</KuiButton>
) }
isOpen={ this.state.isPopoverOpen }
)}
isOpen={this.state.isPopoverOpen2}
closePopover={this.closePopover2.bind(this)}
anchorPosition="left"
closePopover={ () => {} }
>
Popover content
</KuiPopover>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ export default class extends Component {
</KuiButton>
) }
isOpen={ this.state.isPopoverOpen }
closePopover={ this.closePopover.bind(this) }
bodyClassName="yourClassNameHere"
closePopover={ () => {} }
>
It's hard to tell but there's a custom class on this element
</KuiPopover>
Expand Down

0 comments on commit 1eb96a6

Please sign in to comment.