Skip to content

Commit c89e61c

Browse files
committed
Upgrade application with newest Create-react-app
1 parent 27ce2d3 commit c89e61c

17 files changed

+41612
-10343
lines changed

package-lock.json

+29,603-10,290
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+29-19
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,38 @@
11
{
2-
"name": "taxcalc",
3-
"version": "1.0.0",
4-
"description": "React tax calculator",
5-
"keywords": [],
6-
"main": "src/index.js",
2+
"name": "tax-calculator",
3+
"version": "0.1.0",
4+
"private": true,
75
"dependencies": {
8-
"prettier": "^2.2.1",
9-
"react": "16.8.6",
10-
"react-dom": "16.8.6",
11-
"react-scripts": "2.1.8"
12-
},
13-
"devDependencies": {
14-
"typescript": "3.3.3"
6+
"@testing-library/jest-dom": "^5.11.4",
7+
"@testing-library/react": "^11.1.0",
8+
"@testing-library/user-event": "^12.1.10",
9+
"react": "^17.0.2",
10+
"react-dom": "^17.0.2",
11+
"react-scripts": "4.0.3",
12+
"web-vitals": "^1.0.1"
1513
},
1614
"scripts": {
1715
"start": "react-scripts start",
1816
"build": "react-scripts build",
19-
"test": "react-scripts test --env=jsdom",
17+
"test": "react-scripts test",
2018
"eject": "react-scripts eject"
2119
},
22-
"browserslist": [
23-
">0.2%",
24-
"not dead",
25-
"not ie <= 11",
26-
"not op_mini all"
27-
]
20+
"eslintConfig": {
21+
"extends": [
22+
"react-app",
23+
"react-app/jest"
24+
]
25+
},
26+
"browserslist": {
27+
"production": [
28+
">0.2%",
29+
"not dead",
30+
"not op_mini all"
31+
],
32+
"development": [
33+
"last 1 chrome version",
34+
"last 1 firefox version",
35+
"last 1 safari version"
36+
]
37+
}
2838
}

public/favicon.ico

3.78 KB
Binary file not shown.

public/logo192.png

5.22 KB
Loading

public/logo512.png

9.44 KB
Loading

public/manifest.json

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"short_name": "React App",
3+
"name": "Create React App Sample",
4+
"icons": [
5+
{
6+
"src": "favicon.ico",
7+
"sizes": "64x64 32x32 24x24 16x16",
8+
"type": "image/x-icon"
9+
},
10+
{
11+
"src": "logo192.png",
12+
"type": "image/png",
13+
"sizes": "192x192"
14+
},
15+
{
16+
"src": "logo512.png",
17+
"type": "image/png",
18+
"sizes": "512x512"
19+
}
20+
],
21+
"start_url": ".",
22+
"display": "standalone",
23+
"theme_color": "#000000",
24+
"background_color": "#ffffff"
25+
}

public/robots.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# https://www.robotstxt.org/robotstxt.html
2+
User-agent: *
3+
Disallow:

src/App.css

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
.App {
2+
text-align: center;
3+
}
4+
5+
.App-logo {
6+
margin-top: 12em;
7+
height: 40vmin;
8+
pointer-events: none;
9+
}
10+
11+
.App-link {
12+
color: #61dafb;
13+
}

src/app/App.js

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import trinnskatt from '../trinnskatt.png';
2+
import '../App.css';
3+
4+
const App = () => {
5+
return (
6+
<div className="App">
7+
<h1>Kalkulator for trinnskatt</h1>
8+
<div>
9+
10+
</div>
11+
12+
<img src={trinnskatt} className="App-logo" alt="logo" />
13+
</div>
14+
);
15+
}
16+
17+
export default App;

src/calculator.js src/app/calculator.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ import React from "react";
1717
*
1818
*/
1919

20-
export const calculateTrinnskatt = (salary) => {
21-
return -1;
22-
}
20+
export const calculateTrinnskatt = (inntekt) => {
21+
return -1;
22+
}

src/app/calculator.test.js

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { calculateTrinnskatt } from "./calculator";
2+
3+
describe("CalculatorComponent", () => {
4+
5+
it("calculateTrinnskatt should return 0 when salary is 100 000 kroner", () => {
6+
expect(calculateTrinnskatt(100000)).toBe(0);
7+
});
8+
9+
// it("calculateTrinnskatt should return 494 when salary is 200 000 kroner", () => {
10+
// expect(calculateTrinnskatt(200000)).toBe(494);
11+
// });
12+
13+
// it("calculateTrinnskatt should return 3644 when salary is 300 000 kroner", () => {
14+
// expect(calculateTrinnskatt(300000)).toBe(3644);
15+
// });
16+
17+
// it("calculateTrinnskatt should return 27 869 when salary is 700 000 kroner", () => {
18+
// expect(calculateTrinnskatt(700000)).toBe(27869);
19+
// });
20+
});

src/calculator.test.js

-20
This file was deleted.

src/index.css

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
body {
2+
margin: 0;
3+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
4+
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
5+
sans-serif;
6+
-webkit-font-smoothing: antialiased;
7+
-moz-osx-font-smoothing: grayscale;
8+
}
9+
10+
code {
11+
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
12+
monospace;
13+
}

src/index.js

+15-11
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
1-
import React from "react";
2-
import ReactDOM from "react-dom";
1+
import React from 'react';
2+
import ReactDOM from 'react-dom';
3+
import './index.css';
4+
import App from './app/App';
5+
import reportWebVitals from './reportWebVitals';
36

4-
const App = () => {
5-
return (
6-
<div className="App">
7-
<div>Trinnskattskalkulator</div>
8-
</div>
9-
);
10-
}
7+
ReactDOM.render(
8+
<React.StrictMode>
9+
<App />
10+
</React.StrictMode>,
11+
document.getElementById('root')
12+
);
1113

12-
const rootElement = document.getElementById("root");
13-
ReactDOM.render(<App />, rootElement);
14+
// If you want to start measuring performance in your app, pass a function
15+
// to log results (for example: reportWebVitals(console.log))
16+
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
17+
reportWebVitals();

src/reportWebVitals.js

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
const reportWebVitals = onPerfEntry => {
2+
if (onPerfEntry && onPerfEntry instanceof Function) {
3+
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
4+
getCLS(onPerfEntry);
5+
getFID(onPerfEntry);
6+
getFCP(onPerfEntry);
7+
getLCP(onPerfEntry);
8+
getTTFB(onPerfEntry);
9+
});
10+
}
11+
};
12+
13+
export default reportWebVitals;

src/setupTests.js

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// jest-dom adds custom jest matchers for asserting on DOM nodes.
2+
// allows you to do things like:
3+
// expect(element).toHaveTextContent(/react/i)
4+
// learn more: https://github.com/testing-library/jest-dom
5+
import '@testing-library/jest-dom';

0 commit comments

Comments
 (0)