-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
122 lines (106 loc) · 4.55 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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<!-- React-->
<script crossorigin src="https://unpkg.com/react@16/umd/react.production.min.js"></script>
<script crossorigin src="https://unpkg.com/react-dom@16/umd/react-dom.production.min.js"></script>
<!-- Babel -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.26.0/babel.min.js"></script>
<!-- fonts -->
<link href="https://fonts.googleapis.com/css?family=Fjalla+One|Lato:400,400i,700,700i,900,900i" rel="stylesheet">
<!-- Materialize CSS -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/css/materialize.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/js/materialize.min.js"></script>
<!-- responsive -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- styles -->
<!-- <link rel="stylesheet" href="reset.css"> -->
<link rel="stylesheet" href="styles.css">
<title>React TV</title>
<meta description="Practicing React 16 by making a television... ok it's really an Etch-a-Sketch.">
</head>
<body>
<main>
<div class="container">
<h1> React TV</h1>
<p> Ok, it's an Etch-a-Sketch, but it acts like a TV. Go ahead, pick a channel.</p>
<div id="render-reactables" class="channel"></div>
</div>
</main>
<footer class="page-footer">
<div class="container">
<div class="row">
<div class="col l6 s12">
<h2 class="white-text">React TV</h2>
<p class="grey-text text-lighten-4">A React learning project.</p>
</div>
<div class="col l4 offset-l2 s12">
<h3 class="white-text">Ingredients:</h3>
<ul>
<li>React 16</li>
<li>Babel</li>
<li>Materialize CSS</li>
</ul>
</div>
</div>
</div>
<div class="footer-copyright">
<div class="container">
© 2018 Copyright <a href="https://github.com/erinburns">Erin Burns</a>
</div>
</div>
</footer>
<script type="text/babel">
class ReactTv extends React.Component {
constructor(props) {
super(props)
this.state = {
"channel": '',
}
this.catsOn = this.catsOn.bind(this)
this.dogsOn = this.dogsOn.bind(this)
this.abstOn = this.abstOn.bind(this)
} // end constructor
// if channel is null or not null, on click change channel to cats
catsOn() {
let changeChannel = this.state.channel == '' || !'' ? "https://www.youtube.com/embed/rasBWmckwng?rel=0&showinfo=0" : ''
this.setState({ channel: changeChannel });
}
// if channel is null or not null, on click change channel to dogs
dogsOn() {
let changeChannel = this.state.channel == '' || !'' ? "https://www.youtube.com/embed/HZkEJ-Xkow4" : ''
this.setState({ channel: changeChannel });
}
// if channel is null or not null, on click change channel to abstract
abstOn() {
let changeChannel = this.state.channel == '' || !'' ? "https://www.youtube.com/embed/NVb5GV6lntU" : ''
this.setState({ channel: changeChannel });
}
// render the empty iframe and buttons
render() {
return (
<div>
<section className="controls" >
<div onClick={this.catsOn}>
<a class="waves-effect waves-light btn">Cats</a>
</div>
<div onClick={this.dogsOn}>
<a class="waves-effect waves-light btn">Dogs</a>
</div>
<div onClick={this.abstOn}>
<a class="waves-effect waves-light btn">Abstract</a>
</div>
</section>
<iframe width="560" height="315" src={this.state.channel} frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
</div>
) // end return
} // end render
} // end component
ReactDOM.render(
<ReactTv />,
document.getElementById('render-reactables')
)
</script>
</body>
</html>