-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path02-004-index.html
97 lines (80 loc) · 2.35 KB
/
02-004-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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous">
<title>Held you for a little while</title>
</head>
<body>
<!-- container node-->
<div id="jsx"></div>
<!-- container node-->
<div id="dom"></div>
<script src="http://fb.me/react-0.11.1.js"></script>
<script src="http://fb.me/JSXTransformer-0.11.1.js"></script>
<script type="text/jsx">
/** @jsx React.DOM */
var MessageBoxJSX = React.createClass ({
getInitialState: function(){
return {
isVisible: true,
titleMessage: 'Labas rytas, JSX',
messageMaps: [
'pirma žinute.',
'antra žinutė.',
'trečia žinutė.',
'ketvirta žinutė.'
]
}
},
render: function(){
var inlineState= {
display: this.state.isVisible ? 'block' : 'none'
}
var subMessage = 'Nemalonu matyti.';
var messageMapsPublic = this.state.messageMaps.map(function(messageMap){
return <div><SubMessageMap amessage={messageMap} /></div>;
});
return (
<div className="container jumbotron" style={inlineState}>
<h1>Labas rytas, JSX</h1>
<SubMessage message={subMessage}/>
{ messageMapsPublic }
</div>
);
}
});
var SubMessageMap = React.createClass({
getDefaultProps: function () {
return {
amessage: 'Masyvo elementų išspasudinimas.'
}
},
render: function(){
return (
<small>{this.props.amessage}</small>
);
}
});
var SubMessage = React.createClass({
// propTypes: function() {
//// message: React.PropTypes.string.isRequired;
// },
getDefaultProps: function(){
return {
message: 'Malonu tave matyti.'
}
},
render: function(){
return (
<small>{this.props.message}</small>
);
}
});
var reactComponent = React.renderComponent(
<MessageBoxJSX />,
document.getElementById('jsx')
);
</script>
</body>
</html>