Skip to content

Commit 9425013

Browse files
Merge pull request #17 from marcoaraujojunior/develop
Making this app closer to Progressive Web Apps pattern
2 parents 0badef4 + b94d482 commit 9425013

21 files changed

+361
-51
lines changed

app/App.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React from 'react'
22
import ReactDOM from 'react-dom'
33
import { Router, Route, IndexRoute, hashHistory } from 'react-router'
44
import 'bulma/css/bulma.css'
5-
import 'font-awesome-webpack'
5+
import 'style-loader!css-loader!less-loader!font-awesome-webpack/font-awesome-styles.loader!font-awesome-webpack/font-awesome.config.js';
66

77
import iClientComponent from 'components/IClient/IClient'
88
import HomeComponent from 'components/Home/Home'

app/components/Login/Login.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ import { Router } from 'react-router'
44
import User from 'services/User';
55
import ErrorComponent from 'components/Error/Error';
66

7+
const blackStyle = {
8+
color : '#000'
9+
};
10+
711
class Login extends React.Component
812
{
913
constructor(props, context) {
@@ -40,25 +44,27 @@ class Login extends React.Component
4044
<div className="container">
4145
<div className="columns is-vcentered">
4246
<div className="column is-4 is-offset-4">
43-
<h1 className="title has-text-centered">
47+
<p className="title has-text-centered" style={blackStyle}>
4448
IClient
45-
</h1>
49+
</p>
4650
<form onSubmit={this.handleSubmit}>
4751
<div className="box">
4852
<ErrorComponent error={this.state.error} />
49-
<label className="label">Username</label>
53+
<label className="label" htmlFor='username'>Username</label>
5054
<p className="control has-icon">
5155
<input
56+
id='username'
5257
ref='username'
5358
className="input"
5459
type="text"
5560
placeholder="Ex: jsmith"
5661
/>
5762
<i className="fa fa-user" />
5863
</p>
59-
<label className="label">Password</label>
64+
<label className="label" htmlFor='password'>Password</label>
6065
<p className="control has-icon">
6166
<input
67+
id='password'
6268
ref='password'
6369
className="input"
6470
type="password"
@@ -68,7 +74,7 @@ class Login extends React.Component
6874
</p>
6975
<hr />
7076
<p className="control">
71-
<button className="button is-primary">Login</button>
77+
<button className="button is-primary" style={blackStyle}>Login</button>
7278
</p>
7379
</div>
7480
</form>

app/components/Menu/Menu.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react';
22
import { Router } from 'react-router'
33

4-
import Nav from 'components/Nav/Nav'
4+
import NavMenu from 'components/NavMenu/NavMenu'
55
import LinksApp from 'components/LinksApp/LinksApp'
66

77

@@ -26,14 +26,14 @@ class Menu extends React.Component{
2626

2727
handleView() {
2828
return (
29-
<Nav>
29+
<NavMenu>
3030
<LinksApp
3131
links={this.state.links}
3232
/>
3333
<span className="nav-item">
3434
<a className="button" onClick={this.handleLogout}>Logout</a>
3535
</span>
36-
</Nav>
36+
</NavMenu>
3737
);
3838
}
3939

app/components/Nav/Nav.js renamed to app/components/NavMenu/NavMenu.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import React from 'react';
22

3-
class Nav extends React.Component
3+
import Offline from 'components/Offline/Offline'
4+
5+
class NavMenu extends React.Component
46
{
57
constructor(props, context) {
68
super(props, context);
@@ -33,6 +35,11 @@ class Nav extends React.Component
3335
<div className="nav-left">
3436
<a className="nav-item" href="../index.html">IClient</a>
3537
</div>
38+
<span className="nav-center nav-menu is-active">
39+
<span className="nav-item">
40+
<Offline />
41+
</span>
42+
</span>
3643
<span className={ `nav-toggle ${this.state.toggleNavStatus}` } onClick={this.toggleNavStatus}>
3744
<span></span>
3845
<span></span>
@@ -47,9 +54,9 @@ class Nav extends React.Component
4754
}
4855
}
4956

50-
Nav.childContextTypes = {
57+
NavMenu.childContextTypes = {
5158
onClick: React.PropTypes.func
5259
};
5360

54-
export default Nav;
61+
export default NavMenu;
5562

app/components/Offline/Offline.js

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import React from 'react';
2+
3+
class Offline extends React.Component
4+
{
5+
constructor(props, context) {
6+
super(props, context);
7+
this.updateNetworkStatus = this.updateNetworkStatus.bind(this);
8+
this.state = {
9+
networkStatus: {
10+
display: 'none'
11+
}
12+
};
13+
}
14+
15+
componentWillMount() {
16+
this.updateNetworkStatus();
17+
window.addEventListener('online', this.updateNetworkStatus, false);
18+
window.addEventListener('offline', this.updateNetworkStatus, false);
19+
}
20+
21+
updateNetworkStatus() {
22+
if (window.navigator.onLine) {
23+
this.setState({networkStatus: {display : 'none'}});
24+
} else {
25+
this.setState({networkStatus: {display : ''}});
26+
}
27+
}
28+
29+
render() {
30+
return (
31+
<a className="button is-danger is-disabled" style={this.state.networkStatus}>
32+
<span className="icon">
33+
<i className="fa fa-spinner"></i>
34+
</span>
35+
<span>Off Line</span>
36+
</a>
37+
);
38+
}
39+
}
40+
41+
export default Offline;
42+

codecov.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
2+
codecov:
3+
notify:
4+
require_ci_to_pass: true
5+
comment:
6+
behavior: default
7+
layout: header, diff
8+
require_changes: false
9+
coverage:
10+
precision: 2
11+
range:
12+
- 90.0
13+
- 100.0
14+
round: down
15+
status:
16+
changes: false
17+
patch: true
18+
project: true
19+
parsers:
20+
gcov:
21+
branch_detection:
22+
conditional: true
23+
loop: true
24+
macro: false
25+
method: false
26+
javascript:
27+
enable_partials: false
28+

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"react-test-renderer": "^15.3.2",
3434
"style-loader": "^0.13.1",
3535
"url-loader": "^0.5.7",
36-
"webpack": "^1.13.2"
36+
"webpack": "^2.1.0-beta.27"
3737
},
3838
"scripts": {
3939
"test": "jest",
@@ -47,8 +47,8 @@
4747
"app"
4848
],
4949
"collectCoverage": true,
50-
"globals" : {
51-
"HOST" : "http://localhost:3000"
50+
"globals": {
51+
"HOST": "http://localhost:3000"
5252
},
5353
"moduleNameMapper": {
5454
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/tests/__mocks__/fileMock.js",
3.14 KB
Loading
8.38 KB
Loading
1.85 KB
Loading

0 commit comments

Comments
 (0)