-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.js
68 lines (61 loc) · 1.74 KB
/
App.js
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
import React from "react";
import { CharacterForm } from "./select-character-form";
import { Tamagotchi } from "./tamagotchi";
export default class App extends React.Component {
state = {
radioSelected: "tamagotchi1",
showForm: true
};
handleChange = event => {
const value = event.target.value;
this.setState({ radioSelected: value });
};
handleSubmit = () => {
this.setState({ showForm: false });
};
render() {
return (
<div className="box">
<div className="egg">
<div className="screen">
{this.renderInside()}
<div className="shadowline__l" />
<div className="shadowline__inside__r" />
<div className="shadowline__r" />
<div className="shadowline__b" />
<div className="screen__top" />
<div className="screen__bottom" />
</div>
<div className="screen_dynamic" />
<div className="base-shadow" />
<div className="egg__top" />
<div className="egg__highlight" />
<div className="button__container">
<div className="button__left" />
<div className="button__center" />
<div className="button__right" />
</div>
</div>
</div>
);
}
renderInside() {
if (this.state.showForm) {
return (
<div className="character__form">
<CharacterForm
handleChange={this.handleChange.bind(this)}
radioSelected={this.state.radioSelected}
handleSubmit={this.handleSubmit.bind(this)}
/>
</div>
);
} else {
return (
<div>
<Tamagotchi radioSelected={this.state.radioSelected} />
</div>
);
}
}
}