-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathapp.js
53 lines (43 loc) · 1.7 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import React, { Component, PropTypes } from 'react';
import { connect } from 'react-redux';
import { Tooltip, Origin, actions } from '../../src/index';
const { show, hide, delay } = actions;
class App extends Component {
handleTimeout(type, duration) {
this.props.dispatch(show({ origin: this.refs.bold }));
}
render() {
return (
<div>
<h1>Delay Example</h1>
<h2>Basic usage</h2>
<p>
After leaving from <Origin delay className="target">an origin element</Origin>, a tooltip will stay a while.<br />
The default duration is 1.5 seconds.
</p>
<h2>Advanced usage</h2>
<p>
You can specify a duration to delay hiding of a tooltip.<br />
For example: <Origin delay={500} className="target">0.5 second</Origin>, <Origin delay="1000" className="target">1 second</Origin>, <Origin delay={2000.0} className="target">2 seconds</Origin>, <Origin delay="3000.0" className="target">3 seconds</Origin>
</p>
<h2>Delay on show</h2>
<p>
Hovering on an <Origin delay delayOn="show" className="target">origin</Origin>, but it is'n shown immediately.<br />
You need to stay a while on it. Delay on <Origin delay delayOn="both" className="target">both</Origin>.
</p>
<h2>Timeout callback</h2>
<p>
The callback function is <b ref="bold">called</b> when <Origin delay className="target" onTimeout={this.handleTimeout.bind(this)}>timeout</Origin>.
</p>
<Tooltip>
This is a <b>delay</b> tooltip.
</Tooltip>
</div>
);
}
}
function select(state) {
const { app } = state;
return { app };
}
export default connect(select)(App);