Skip to content

Commit 15309a6

Browse files
committed
fix merge conflics
2 parents d087bc1 + 38d46ee commit 15309a6

File tree

12 files changed

+2167
-2091
lines changed

12 files changed

+2167
-2091
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ node_modules/
22
.cache/
33
dist/
44
.vscode/
5+
coverage/

components/answer/answer.css

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
li {
2+
list-style-type: none;
3+
display: inline;
4+
margin: 1em;
5+
}

components/answer/answer.js

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import React from 'react';
2+
3+
const Answer = (props) => {
4+
const city = props.city;
5+
const listItems = city.split('').map((char, index) => <li key={index + char.toUpperCase()}>_</li>);
6+
return (
7+
<ul>{listItems}</ul>
8+
)
9+
}
10+
11+
export default Answer;

components/app/app.js

+8
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,14 @@ import fetchGameData from '../../utils/fetchGameData/fetchGameData'
33
import selectRandomCounty from "../../utils/selectRandomCounty/selectRandomCounty";
44
import Title from '../title/title';
55
import Hint from '../hint/hint';
6+
import Chance from '../chance/chance';
7+
import Answer from '../answer/answer';
8+
import Letters from '../letter/letter';
69

710
export default class App extends React.Component {
811
state = {
912
playing: true,
13+
chances: 5,
1014
country: '',
1115
city: '',
1216
}
@@ -20,10 +24,14 @@ export default class App extends React.Component {
2024
}
2125

2226
render() {
27+
2328
return (
2429
<React.Fragment>
2530
<Title />
2631
<Hint country={this.state.country}/>
32+
<Chance chances={this.state.chances} />
33+
<Answer city={this.state.city} />
34+
<Letters />
2735
</React.Fragment>
2836
)
2937
}

components/app/app.test.js

-7
This file was deleted.

components/chance/chance.js

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import React from 'react';
2+
3+
const Chance = props => <h4>You have {props.chances} chances left</h4>;
4+
5+
export default Chance;

components/game/game.js

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import React from 'react';
2+
import Hint from '../hint/hint';
3+
import Chance from '../chance/chance';
4+
import Answer from '../answer/answer';
5+
import Letters from '../letter/letter';
6+
7+
export default class Game extends React.Component {
8+
state = {
9+
chances: 5,
10+
country: 'Italy',
11+
city: "Rome"
12+
}
13+
render() {
14+
15+
return (
16+
<React.Fragment>
17+
<Hint country={this.state.country}/>
18+
<Chance chances={this.state.chances} />
19+
<Answer city={this.state.city} />
20+
<Letters />
21+
</React.Fragment>
22+
)
23+
}
24+
}

components/hint/hint.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import React from 'react';
1+
import React from 'react';
22

33
const Hint = props => <h3>What's the capital of {props.country}?</h3>;
44

5-
export default Hint;
5+
export default Hint;

components/letter/letter.js

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import React from 'react';
2+
3+
const alphabet = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
4+
'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S',
5+
'T', 'U', 'V', 'W', 'X', 'Y', 'Z'];
6+
7+
const Letters = () => {
8+
const listItems = alphabet.map((el) =>
9+
<li key={el}><button>{el}</button></li>);
10+
return (
11+
<ul className="letterName">{listItems}</ul>
12+
);
13+
}
14+
15+
export default Letters;
16+
17+
18+

index.html

+15-10
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
<!DOCTYPE html>
2-
<html>
3-
<head>
4-
<meta charset="utf-8">
5-
<title>My App</title>
6-
</head>
7-
<body>
8-
<div id="root"></div>
9-
<script src="index.js"></script>
10-
</body>
11-
</html>
2+
<html lang="en">
123

4+
<head>
5+
<meta charset="utf-8">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
8+
<title>Cities Hangman</title>
9+
10+
</head>
11+
12+
<body>
13+
<div id="root"></div>
14+
<script src="index.js"></script>
15+
</body>
16+
17+
</html>

0 commit comments

Comments
 (0)