Skip to content

Commit 78f92f6

Browse files
committed
Updated step-4
1 parent adec807 commit 78f92f6

File tree

6 files changed

+31
-16
lines changed

6 files changed

+31
-16
lines changed

src/App.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,4 +229,9 @@
229229

230230
.offline__container img {
231231
max-width: 100%;
232+
}
233+
234+
.offline i {
235+
margin-bottom: 20px;
236+
display: block;
232237
}

src/Menu.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ class Menu extends Component {
8585
<li>
8686
<NavLink to="/offline">
8787
<span className="menu__steps">4</span>
88-
Offline
88+
App Shell
8989
</NavLink>
9090
</li>
9191
<li>

src/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import App from './App';
55
import Introduction from './step-1/Introduction';
66
import Setup from './step-2/Setup';
77
import ServiceWorker from './step-3/ServiceWorker';
8-
import Offline from './step-4/Offline';
8+
import AppShell from './step-4/AppShell';
99
import Push from './step-5/Push';
1010
import BGSync from './step-6/BGSync';
1111
import Finish from './step-7/Finish';
@@ -22,7 +22,7 @@ ReactDOM.render(
2222
<Route path="/introduction" component={Introduction} />
2323
<Route path="/setup" component={Setup} />
2424
<Route path="/serviceworker" component={ServiceWorker} />
25-
<Route path="/offline" component={Offline} />
25+
<Route path="/offline" component={AppShell} />
2626
<Route path="/push" component={Push} />
2727
<Route path="/bgsync" component={BGSync} />
2828
<Route path="/finish" component={Finish} />

src/step-3/ServiceWorker.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ self.addEventListener('fetch', function (event) {
7676
<h1>3. Service Worker</h1>
7777
<p>A service worker is a event driven worker which runs in the background and sits in between your application and the browser. It can intercept and handle the network requests for the registered domain. It doesn't have <span className="hightlight bold no--bg">DOM</span> access.</p>
7878
<Note type="notes">
79-
<p><span>Note: </span> Service worker will work only when the page is served via https. For testing and development purposes it works in <span className="hightlight bold no--bg">http://localhost</span>.</p>
79+
<p><span>Tips: </span> Service worker will work only when the page is served via https. For testing and development purposes it works in <span className="hightlight bold no--bg">http://localhost</span>.</p>
8080
</Note>
8181

8282
<p>Know more about <a href="https://github.com/w3c/ServiceWorker/blob/master/explainer.md" target="_blank">service worker</a>.</p>
Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,46 @@
11
import React, {Component} from 'react';
22
import Note from '../Note';
3-
import appShell from './app-shell.png';
3+
import appShellImg from './app-shell.png';
44
import appOffline from './offline-app.png';
5+
import cachedResources from './cached-resources.png';
56

6-
class Offline extends Component {
7+
class AppShell extends Component {
78
render() {
89
return(
910
<div className="offline">
10-
<h1>Offline</h1>
11-
<p>Making an application to work in offline is powerful feature. By following app shell architecture, we can achieve fast and more reliable user interface.</p>
12-
13-
<h2>What is App Shell Architecture?</h2>
14-
<p>An app shell architecture is minimal level <span className="hightlight bold no--bg">HTML, CSS, Javascript</span> required to show the application user interface. By caching the app shell, application loads fast and repeated visits loads even faster.</p>
15-
11+
<h1>What is App Shell Architecture?</h1>
12+
<p>An app shell architecture is minimal level <span className="hightlight bold no--bg">HTML, CSS, Javascript</span> required to show the application user interface. By caching the app shell, application loads faster on the initial load and even faster on repeated visits.</p>
13+
1614
<i>Note: To save some coding time, App shell is already added to the codelabs sample repository.</i>
1715

1816
<div className="offline__container">
19-
<img src={appShell} alt="app shell" />
17+
<img src={appShellImg} alt="app shell" />
2018
</div>
2119

2220
<Note type="facts">
2321
<p><span>Facts: </span> Housing.com used app shell architecture in their <a href="housing.com" target="_blank">progressive web app</a> to load the page 30% faster than before. Read thier full <a href="https://developers.google.com/web/showcase/2016/pdfs/housing.pdf" target="_blank">case study</a>.</p>
2422
</Note>
23+
24+
<h2>Offline</h2>
25+
<p>Service worker allow us to use cache API to cache the resources and thus by providing offline experience.</p>
2526

26-
<p>Let the user know when he goes offline is an important feature.</p>
27-
27+
<i>Note: Resources cached via cache API can be view in application tab in chrome DevTools. Refer the below image.</i>
28+
29+
<div className="offline__container">
30+
<img className="" src={cachedResources} alt="cached resources" />
31+
</div>
32+
33+
<p>More details about <a href="https://developer.mozilla.org/en-US/docs/Web/API/CacheStorage">Cache API</a>.</p>
34+
35+
<h2>Taking advantage of built-in events</h2>
36+
2837
<div className="offline__container">
2938
<img className="" src={appOffline} alt="app offline" />
3039
</div>
40+
3141
</div>
3242
);
3343
}
3444
}
3545

36-
export default Offline;
46+
export default AppShell;

src/step-4/cached-resources.png

74.9 KB
Loading

0 commit comments

Comments
 (0)