forked from ReactTooltip/react-tooltip
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
85 lines (77 loc) · 3.05 KB
/
index.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
'use strict';
import React from "react";
import ReactTooltip from "./react-tooltip.js";
const Test = React.createClass({
getInitialState() {
return {
place: "top",
type: "dark",
effect: "float"
}
},
changePlace(place) {
this.setState({
place: place
})
},
changeType(type) {
this.setState({
type: type
})
},
changeEffect(effect) {
this.setState({
effect: effect
})
},
render() {
let { place, type, effect } = this.state;
return (
<section className="tooltip-example">
<h4 className="title">React Tooltip</h4>
<div className="demonstration">
<a data-tip="React-tooltip">
( ◕‿‿◕ )
<p>akjlshfkjahlskjdfhjadsfjasdfhjkahdsjf</p>
<span>jksadhfklaskjdhfjk</span>
</a>
</div>
<div className="control-panel">
<div className="button-group">
<div className="item">
<p>Place</p>
<a className={place==="top"?"active":""} onClick={this.changePlace.bind(this,"top")}>Top<span className="mark">(default)</span></a>
<a className={place==="right"?"active":""} onClick={this.changePlace.bind(this,"right")}>Right</a>
<a className={place==="bottom"?"active":""} onClick={this.changePlace.bind(this,"bottom")}>Bottom</a>
<a className={place==="left"?"active":""} onClick={this.changePlace.bind(this,"left")}>Left</a>
</div>
<div className="item">
<p>Type</p>
<a className={type==="dark"?"active":""} onClick={this.changeType.bind(this,"dark")}>Dark<span className="mark">(default)</span></a>
<a className={type==="success"?"active":""} onClick={this.changeType.bind(this,"success")}>Success</a>
<a className={type==="warning"?"active":""} onClick={this.changeType.bind(this,"warning")}>Warning</a>
<a className={type==="error"?"active":""} onClick={this.changeType.bind(this,"error")}>Error</a>
<a className={type==="info"?"active":""} onClick={this.changeType.bind(this,"info")}>Info</a>
<a className={type==="dlight"?"active":""} onClick={this.changeType.bind(this,"light")}>Light</a>
</div>
<div className="item">
<p>Effect</p>
<a className={effect==="float"?"active":""} onClick={this.changeEffect.bind(this,"float")}>Float<span className="mark">(default)</span></a>
<a className={effect==="solid"?"active":""} onClick={this.changeEffect.bind(this,"solid")}>Solid</a>
</div>
</div>
<pre>
<div>
<p className="label">Code</p>
<hr></hr>
<p>{"<a data-tip='React-tooltip'>( ◕‿‿◕ )</a>"}</p>
<p>{"<ReactTooltip place='"+place+"' type='"+type+"' effect='"+effect+"'/>"}</p>
</div>
</pre>
</div>
<ReactTooltip place={place} type={type} effect={effect}/>
</section>
)
}
});
React.render(<Test />, document.body);