Skip to content

Commit 293d24e

Browse files
committed
make it PWA
1 parent 0623a55 commit 293d24e

17 files changed

+521
-262
lines changed

package-lock.json

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

package.json

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
2-
"name": "test-react-cards",
2+
"name": "react-notes",
33
"version": "0.1.0",
44
"private": true,
55
"dependencies": {
66
"@testing-library/jest-dom": "^5.11.10",
7-
"@testing-library/react": "^11.2.5",
7+
"@testing-library/react": "^11.2.6",
88
"@testing-library/user-event": "^12.8.3",
99
"bootstrap": "^4.6.0",
1010
"bootstrap-icons": "^1.4.1",
@@ -14,7 +14,19 @@
1414
"react-scripts": "4.0.3",
1515
"react-stack-grid": "^0.7.1",
1616
"react-textarea-autosize": "^8.3.2",
17-
"web-vitals": "^1.1.1"
17+
"web-vitals": "^0.2.4",
18+
"workbox-background-sync": "^5.1.4",
19+
"workbox-broadcast-update": "^5.1.4",
20+
"workbox-cacheable-response": "^5.1.4",
21+
"workbox-core": "^5.1.4",
22+
"workbox-expiration": "^5.1.4",
23+
"workbox-google-analytics": "^5.1.4",
24+
"workbox-navigation-preload": "^5.1.4",
25+
"workbox-precaching": "^5.1.4",
26+
"workbox-range-requests": "^5.1.4",
27+
"workbox-routing": "^5.1.4",
28+
"workbox-strategies": "^5.1.4",
29+
"workbox-streams": "^5.1.4"
1830
},
1931
"scripts": {
2032
"start": "react-scripts start",

public/index.html

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,8 @@
44
<meta charset="utf-8" />
55
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
66
<meta name="viewport" content="width=device-width, initial-scale=1" />
7-
<meta name="theme-color" content="#000000" />
8-
<meta
9-
name="description"
10-
content="Web site created using create-react-app"
11-
/>
7+
<meta name="theme-color" content="#D3D3D3" />
8+
<meta name="description" content="Web site created using create-react-app. This is a React Notes app" />
129
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
1310
<!--
1411
manifest.json provides metadata used when your web app is installed on a
@@ -24,7 +21,7 @@
2421
work correctly both with client-side routing and a non-root public URL.
2522
Learn how to configure a non-root public URL by running `npm run build`.
2623
-->
27-
<title>Cards</title>
24+
<title>React Notes</title>
2825
</head>
2926
<body>
3027
<noscript>You need to enable JavaScript to run this app.</noscript>

public/manifest.json

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"short_name": "Cards - React App",
3-
"name": "Create React App Sample",
2+
"short_name": "React Notes",
3+
"name": "React Notes App",
44
"icons": [
55
{
66
"src": "favicon.ico",
@@ -16,10 +16,22 @@
1616
"src": "logo512.png",
1717
"type": "image/png",
1818
"sizes": "512x512"
19+
},
20+
{
21+
"src": "maskable_icon_x192.png",
22+
"sizes": "196x196",
23+
"type": "image/png",
24+
"purpose": "any maskable"
25+
},
26+
{
27+
"src": "maskable_icon_x512.png",
28+
"sizes": "512x512",
29+
"type": "image/png",
30+
"purpose": "any maskable"
1931
}
2032
],
21-
"start_url": ".",
33+
"start_url": "/?source=pwa",
2234
"display": "standalone",
23-
"theme_color": "#000000",
24-
"background_color": "#ffffff"
25-
}
35+
"theme_color": "#FFFFFF",
36+
"background_color": "#FFFFFF"
37+
}

public/maskable_icon_x192.png

26.4 KB
Loading

public/maskable_icon_x512.png

111 KB
Loading

src/App.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
import React from 'react';
12
import logo from './logo.svg';
23
import './App.css';
3-
import React from 'react'
44
import CardList from './Cards/CardList'
55
import AddCard from './Cards/AddCard'
66
import Context from './context'

src/App.test.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import React from 'react';
2+
import { render, screen } from '@testing-library/react';
3+
import App from './App';
4+
5+
test('renders learn react link', () => {
6+
render(<App />);
7+
const linkElement = screen.getByText(/learn react/i);
8+
expect(linkElement).toBeInTheDocument();
9+
});

src/Cards/CardItem.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@ function CardItem(props) {
2727

2828
<div className="card-body pt-0">
2929
<button
30-
className="btn btn-light p-0"
31-
style={{ width: "1.8em", height: "1.8em", float: "right" }}
30+
className={`btn btn-${props.card.completed ? "success" : "danger"} p-0`}
31+
style={{ width: "1.8em", height: "1.8em", float: "right", borderColor: "transparent" }}
3232
onClick={() => removeCard(props.index)}
3333
>
3434
&#10007;
3535
</button>
3636
<button
37-
className="btn btn-light p-0 mx-2"
38-
style={{ width: "1.8em", height: "1.8em", float: "right" }}
37+
className={`btn btn-${props.card.completed ? "success" : "danger"} p-0 mx-2`}
38+
style={{ width: "1.8em", height: "1.8em", float: "right", borderColor: "transparent" }}
3939
onClick={() => changeCardState(props.index)}
4040
>
4141
&#10003;

src/Modal/ModalLogin.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ function ModalLogin(props) {
6565
</div>)
6666
})
6767
} else if (input.value) {
68-
setLabelAlert(<div className="alert alert-warning my-1" role="alert">Исправьте логин</div>)
68+
setLabelAlert(<div className="alert alert-warning my-1" role="alert">{input.value.length > 3 ? "Исправьте логин" : "Слишком короткий логин"}</div>)
6969
} else {
70-
setLabelAlert(<div className="alert alert-info my-1" role="alert">Поле "Логин" не должно быть пустым</div>)
70+
setLabelAlert(<div className="alert alert-info my-1" role="alert">Поле "Username" не должно быть пустым</div>)
7171
}
7272
}
7373

@@ -96,7 +96,7 @@ function ModalLogin(props) {
9696

9797
<div className='bg-light form-group'>
9898
{labelAlert}
99-
<label htmlFor="login">Логин</label>
99+
<label htmlFor="login">Username</label>
100100
<input
101101
type="text"
102102
className="form-control"

0 commit comments

Comments
 (0)