-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
64 lines (61 loc) · 2.03 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
<!DOCTYPE html>
<html>
<head>
<title>A E S T H E T I C G E N E R A T O R</title>
<meta charset="utf-8"/>
</head>
<body>
<div id="app"></div>
<p>
<a href="https://github.com/sodle/aestheticjs/blob/gh-pages/index.html">View Source</a>
</p>
</body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.26.0/babel.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.4.1/umd/react.production.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.4.1/umd/react-dom.production.min.js"></script>
<script type="text/babel">
class Input extends React.Component {
render() {
return (
<div>
<h1>Enter your text:</h1>
<p>
<input type={'text'} onChange={this.props.onChange} value={this.props.text} />
</p>
</div>
);
}
}
class Output extends React.Component {
render() {
return (
<div>
<pre>{this.props.output}</pre>
</div>
);
}
}
class App extends React.Component {
state = {
text: 'aesthetic text generator'
}
setText(event) {
this.setState({
text: event.target.value
});
}
getOutput() {
return this.state.text.split('').join(' ');
}
render() {
return (
<div>
<Input onChange={this.setText.bind(this)} text={this.state.text} />
<Output output={this.getOutput()} />
</div>
);
}
}
ReactDOM.render(<App/>, document.getElementById('app'));
</script>
</html>