From a3a2bf9c7d2448cdc26dd3edc66b0ceef7148c98 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sun, 29 Jul 2018 15:23:30 +0800 Subject: [PATCH] demo: upgrade popover demo --- components/popover/demo/hover-with-click.md | 44 ++++++++++----------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/components/popover/demo/hover-with-click.md b/components/popover/demo/hover-with-click.md index c507e81149..3f7933bc8a 100644 --- a/components/popover/demo/hover-with-click.md +++ b/components/popover/demo/hover-with-click.md @@ -16,29 +16,16 @@ The following example shows how to create a popover which can be hovered and cli ````jsx import { Popover, Button } from 'antd'; -const hoverContent = ( -
- This is hover content. -
-); - -const clickContent = ( -
- This is click content. -
-); - -const initalState = { - clicked: false, - hovered: false, -}; - class App extends React.Component { - state = initalState; + state = { + clicked: false, + hovered: false, + }; hide = () => { this.setState({ - ...initalState, + clicked: false, + hovered: false, }); } @@ -57,9 +44,18 @@ class App extends React.Component { } render() { + const hoverContent = ( +
+ This is hover content. +
+ ); + const clickContent = ( +
+ This is click content. +
+ ); return ( Close]} + content={( +
+ {clickContent} + Close +
+ )} title="Click title" trigger="click" visible={this.state.clicked}