From 068dc8ec388c33bc5572ca63f1be0533e9d81b2a Mon Sep 17 00:00:00 2001 From: Ilan Date: Sun, 29 Jul 2018 01:34:49 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20popover=20that=20can=20be=20hovered?= =?UTF-8?q?=20and=20clicked?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../__tests__/__snapshots__/demo.test.js.snap | 11 +++ components/popover/demo/hover-with-click.md | 86 +++++++++++++++++++ 2 files changed, 97 insertions(+) create mode 100644 components/popover/demo/hover-with-click.md diff --git a/components/popover/__tests__/__snapshots__/demo.test.js.snap b/components/popover/__tests__/__snapshots__/demo.test.js.snap index f9d82fa3c0..860bc98ce3 100644 --- a/components/popover/__tests__/__snapshots__/demo.test.js.snap +++ b/components/popover/__tests__/__snapshots__/demo.test.js.snap @@ -43,6 +43,17 @@ exports[`renders ./components/popover/demo/control.md correctly 1`] = ` `; +exports[`renders ./components/popover/demo/hover-with-click.md correctly 1`] = ` + +`; + exports[`renders ./components/popover/demo/placement.md correctly 1`] = `
+ This is hover content. +
+); + +const clickContent = ( +
+ This is click content. +
+); + +const initalState = { + clicked: false, + hovered: false, +}; + +class App extends React.Component { + state = initalState; + + hide = () => { + this.setState({ + ...initalState, + }); + } + + handleHoverChange = (visible) => { + this.setState({ + hovered: visible, + clicked: false, + }); + } + + handleClickChange = (visible) => { + this.setState({ + clicked: visible, + hovered: false, + }); + } + + render() { + return ( + + Close]} + title="Click title" + trigger="click" + visible={this.state.clicked} + onVisibleChange={this.handleClickChange} + > + + + + ); + } +} + +ReactDOM.render(, mountNode); +````