Skip to content

Commit b334ca0

Browse files
update cookbook (14.09.18)
1 parent 90180c0 commit b334ca0

File tree

15 files changed

+286
-220
lines changed

15 files changed

+286
-220
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
.idea/
1+
.idea/
2+
node_modules/

cookbook/cookbook/package-lock.json

Lines changed: 72 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cookbook/cookbook/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"dependencies": {
66
"react": "^16.5.0",
77
"react-dom": "^16.5.0",
8+
"react-router-dom": "^4.3.1",
89
"react-scripts": "1.1.5"
910
},
1011
"scripts": {
@@ -13,4 +14,4 @@
1314
"test": "react-scripts test --env=jsdom",
1415
"eject": "react-scripts eject"
1516
}
16-
}
17+
}

cookbook/cookbook/src/App.css

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,6 @@ label {
112112
margin-left: 45px;
113113
}
114114

115-
/*.Login {*/
116-
/*display: none;*/
117-
/*}*/
118-
119115
.user-login {
120116
margin-left: 20px;
121117
}
@@ -128,7 +124,6 @@ label {
128124
}
129125

130126
.recept-edit-cake {
131-
/*border: 1px solid #00040e;*/
132127
width: 470px;
133128
height: 400px;
134129
}
@@ -148,6 +143,7 @@ label {
148143
width: 270px;
149144
height: 270px;
150145
display: block;
146+
margin-left: -40px;
151147
}
152148

153149
.recept-control-button {
@@ -186,10 +182,6 @@ h2.recept-name {
186182
height: 210px;
187183
}
188184

189-
li.ul-li {
190-
list-style-type: none;
191-
}
192-
193185
.recept-edit-button {
194186
padding-top: 75px;
195187
}
@@ -205,10 +197,6 @@ li.ul-li {
205197
font-size: 17px
206198
}
207199

208-
/*.Recept-edit {*/
209-
/*display: none;*/
210-
/*}*/
211-
212200
.dashboard {
213201
font-family: 'Brush Script MT', Trattatello;
214202
color: #5389a6;
@@ -276,24 +264,20 @@ li.ul-li {
276264

277265
.list-ingredients-dish {
278266
width: 200px;
267+
font-size: 25px;
279268
}
280269

281270
ol {
282-
font-size: 30px;
283271
margin: 0px;
284272
}
285273

286-
.dish-ingredient {
287-
font-size: 25px;
288-
}
289-
290274
.sum-ingredients {
291275
text-align: center;
292276
padding-top: 50px;
293277
font-size: 30px;
294278
}
295279

296-
.manage-recipe-button {
280+
.button-remove {
297281
height: 30px;
298282
width: 150px;
299283
border-radius: 3px;
@@ -305,7 +289,7 @@ ol {
305289
margin: 20px 20px;
306290
}
307291

308-
/*.Recepts {*/
309-
/*display: none;*/
310-
/*}*/
292+
a {
293+
text-decoration: none;
294+
}
311295

cookbook/cookbook/src/App.js

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,28 @@
1-
import React, { Component } from 'react';
1+
import React, {Component, Fragment} from 'react';
2+
import {Link, Route} from 'react-router-dom';
23
import logo from './logo.svg';
34
import './App.css';
4-
import {Login} from "./pages/autorization-page";
5-
import {Recepts} from "./pages/recepts-page";
6-
import {ReceptEdit} from "./pages/edit-recept-page";
5+
import {Login} from "./pages/autorization-page/autorization-page";
6+
import {Recepts} from "./pages/recepts-page/recepts-page";
7+
import {ReceptEdit} from "./pages/edit-recept-page/edit-recept-page";
8+
import {HeaderComponent} from "./shared-components/header-component";
79

810
class App extends Component {
9-
constructor() {
10-
super();
11-
this.state = {
12-
activePage: 'login'
13-
}
14-
}
11+
// constructor() {
12+
// super();
13+
// this.state = {
14+
// activePage: 'recepts'
15+
// }
16+
// }
1517
render() {
16-
17-
if(this.state.activePage === 'login') {
18-
return <Login />
19-
}
20-
21-
if(this.state.activePage === 'recepts') {
22-
return <Recepts />
23-
}
24-
25-
if(this.state.activePage === 'recept-edit') {
26-
return <ReceptEdit />
27-
}
18+
return (
19+
<Fragment>
20+
<HeaderComponent withUser={true}/>
21+
<Route exact path="/login-page" component={Login}/>
22+
<Route exact path="/recepts" component={Recepts}/>
23+
<Route exact path="/recept-edit" component={ReceptEdit}/>
24+
</Fragment>
25+
);
2826
}
2927
}
3028

cookbook/cookbook/src/index.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
11
import React from 'react';
22
import ReactDOM from 'react-dom';
3+
import {BrowserRouter} from 'react-router-dom';
34
import './index.css';
45
import App from './App';
56
import registerServiceWorker from './registerServiceWorker';
67

7-
ReactDOM.render(<App />, document.getElementById('root'));
8+
const RouteApp = () => {
9+
return (
10+
<BrowserRouter>
11+
<App />
12+
</BrowserRouter>
13+
);
14+
};
15+
16+
ReactDOM.render(<RouteApp />, document.getElementById('root'));
817
registerServiceWorker();

cookbook/cookbook/src/pages/autorization-page.js

Lines changed: 0 additions & 31 deletions
This file was deleted.
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import React, {Component} from 'react';
2+
import {Link} from 'react-router-dom';
3+
4+
export class Login extends Component {
5+
constructor() {
6+
super();
7+
this.state = {
8+
userNameValue: '',
9+
passwordValue: ''
10+
}
11+
};
12+
13+
changeInputUserName = (event) => {
14+
this.setState({
15+
userNameValue: event.target.value
16+
})
17+
};
18+
19+
changeInputPassword = (event) => {
20+
this.setState({
21+
passwordValue: event.target.value
22+
})
23+
};
24+
25+
render() {
26+
const {
27+
userNameValue,
28+
passwordValue
29+
} = this.state;
30+
31+
return(
32+
<div className="Login">
33+
<main className="main">
34+
<div className="authorization_form">
35+
<form>
36+
<h2 className="authorization_caption">Welcome to the book of recipes</h2>
37+
<hr/>
38+
<label>Username<input className="authorization_input" type="text"
39+
placeholder="enter username"
40+
value={userNameValue}
41+
onChange={this.changeInputUserName}/></label>
42+
<label>Password<input className="authorization_input" type="password"
43+
placeholder="enter password"
44+
value={passwordValue}
45+
onChange={this.changeInputPassword}/></label>
46+
<Link to='recepts'>
47+
<button className="authorization_button">Sign in</button>
48+
</Link>
49+
<label><input className="authorization_checkbox" type="checkbox" defaultChecked/>Remember me</label>
50+
</form>
51+
</div>
52+
</main>
53+
</div>
54+
)
55+
}
56+
}

0 commit comments

Comments
 (0)