Skip to content

Commit 700ccbb

Browse files
committed
Initial commit + completed 2 tutorials
Tutorial 1 and tutorial 2 complete 2 Hello world components with spanishify and lebanify buttons
1 parent f19940b commit 700ccbb

File tree

4 files changed

+53
-45
lines changed

4 files changed

+53
-45
lines changed

src/App.css

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1 @@
1-
.App {
2-
text-align: center;
3-
}
41

5-
.App-logo {
6-
animation: App-logo-spin infinite 20s linear;
7-
height: 80px;
8-
}
9-
10-
.App-header {
11-
background-color: #222;
12-
height: 150px;
13-
padding: 20px;
14-
color: white;
15-
}
16-
17-
.App-title {
18-
font-size: 1.5em;
19-
}
20-
21-
.App-intro {
22-
font-size: large;
23-
}
24-
25-
@keyframes App-logo-spin {
26-
from { transform: rotate(0deg); }
27-
to { transform: rotate(360deg); }
28-
}

src/App.js

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,14 @@
1-
import React, { Component } from 'react';
2-
import logo from './logo.svg';
1+
import React from 'react';
32
import './App.css';
3+
import HelloWorld from './HelloWorld';
44

5-
class App extends Component {
6-
render() {
7-
return (
8-
<div className="App">
9-
<header className="App-header">
10-
<img src={logo} className="App-logo" alt="logo" />
11-
<h1 className="App-title">Welcome to React</h1>
12-
</header>
13-
<p className="App-intro">
14-
To get started, edit <code>src/App.js</code> and save to reload.
15-
</p>
16-
</div>
17-
);
18-
}
19-
}
5+
const App = () => {
6+
return (
7+
<div className="App">
8+
<HelloWorld name="World"/>
9+
<HelloWorld name="React"/>
10+
</div>
11+
);
12+
};
2013

21-
export default App;
14+
export default App;

src/HelloWorld.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.HelloWorld {
2+
border: 6px solid black;
3+
text-align: center;
4+
background: #c7e3f7;
5+
color: #333;
6+
margin: 20px;
7+
padding: 20px;
8+
}

src/HelloWorld.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import React, { Component } from 'react';
2+
import './HelloWorld.css';
3+
4+
5+
class HelloWorld extends Component {
6+
constructor (props) {
7+
super (props);
8+
this.state = { greeting: 'Hello' };
9+
this.spanishify = this.spanishify.bind(this);
10+
this.lebanify = this.lebanify.bind(this);
11+
}
12+
spanishify() {
13+
this.setState({ greeting: 'Hola' });
14+
}
15+
lebanify() {
16+
this.setState({ greeting: 'Hi, keefak, sa va' });
17+
}
18+
render () {
19+
return (
20+
<div className="HelloWorld">
21+
{this.state.greeting} {this.props.name}!
22+
<br/>
23+
<button onClick={this.spanishify}>Spanishify!</button>
24+
<button onClick={this.lebanify}>Lebanify!</button>
25+
</div>
26+
);
27+
}
28+
}
29+
30+
/* const HelloWorld = props => {
31+
return (<div className="HelloWorld">Hello {props.name}!</div>);
32+
}; */
33+
34+
export default HelloWorld;

0 commit comments

Comments
 (0)