-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
169 lines (155 loc) · 3.44 KB
/
index.html
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
<!doctype html>
<html>
<head>
<meta charset="utf-8"/>
<title>React Frame</title>
<style type="text/css">
body {
color: #222;
font-family: "Helvetica Neue", sans-serif;
font-weight: 200;
margin: 0 50px;
}
.react-draggable, .cursor {
cursor: move;
}
.no-cursor {
cursor: auto;
}
.cursor-y {
cursor: ns-resize;
}
.cursor-x {
cursor: ew-resize;
}
.react-draggable strong {
background: #ddd;
border: 1px solid #999;
border-radius: 3px;
display: block;
margin-bottom: 10px;
padding: 3px 5px;
text-align: center;
}
.show {
display: block;
}
.hide {
display: none;
}
.box {
position:absolute;
box-sizing: border-box;
background: #fff;
border: 1px solid #999;
border-radius: 3px;
width: 180px;
height: 180px;
margin: 10px;
padding: 10px;
float: left;
}
.top {
width: 500px;
height:50px;
background:#ffff22;
}
.bottom {
width:500px;
height:80px;
background:#33ff22;
}
.left {
width:100px;
height:400px;
}
.right {
width: 400px;
height: 400px;
background:#999999;
}
.example-enter {
opacity: 0.01;
}
.example-enter.example-enter-active {
opacity: 1;
transition: opacity 2000ms ease-in;
}
.example-leave {
opacity: 1;
}
.example-leave.example-leave-active {
/* opacity: 0.01;
transition: opacity 1000ms ease-in;*/
-webkit-transform: translate3d(100%, 0, 1px);
transform: translate3d(100%, 0, 0);
-webkit-transition-duration: .5s;
transition-duration: .5s;
}
.button.switch-enter {
opacity: 0.01;
}
.button.switch-enter.switch-enter-active {
opacity: 1.0;
}
.button.switch-leave {
/* Completely hide the button while it's being animated and before it's removed from the DOM. */
visibility: hidden;
height: 0px;
width: 0px;
/* Starting opacity */
opacity: 1.0;
}
.button.switch-leave.switch-leave-active {
/* Ending opacity:
Trigger opacity change so the "transitionend" event will fire, causing React to remove from the DOM. */
opacity: 0;
}
</style>
</head>
<body>
<div id=container>
</div>
<script src="//fb.me/react-with-addons-0.13.2.js"></script>
<script src="//fb.me/JSXTransformer-0.13.2.js"></script>
<script type="text/jsx">
var ReactTransitionGroup = React.addons.CSSTransitionGroup;
//-------------------------------------------
var TodoList = React.createClass({
getInitialState: function() {
return {items: ['hello', 'world', 'click', 'me']};
},
handleAdd: function() {
var newItems =
this.state.items.concat([prompt('Enter some text')]);
this.setState({items: newItems});
},
handleRemove: function(i) {
var newItems = this.state.items;
newItems.splice(i, 1);
this.setState({items: newItems});
},
render: function() {
var items = this.state.items.map(function(item, i) {
return (
<div key={item} onClick={this.handleRemove.bind(this, i)}>
{item}
</div>
);
}.bind(this));
return (
<div>
<button onClick={this.handleAdd}>Add Item</button>
<ReactCSSTransitionGroup transitionName="example" transitionEnterTimeout={500} transitionLeaveTimeout={300} >
{items}
</ReactCSSTransitionGroup>
</div>
);
}
});
var todolist = document.createElement("div");
document.body.appendChild(todolist);
React.render(<TodoList/>, todolist);
</script>
</body>
</html>