diff --git a/.gitignore b/.gitignore
index d30f40e..704fa39 100644
--- a/.gitignore
+++ b/.gitignore
@@ -19,3 +19,4 @@
npm-debug.log*
yarn-debug.log*
yarn-error.log*
+.idea
\ No newline at end of file
diff --git a/.idea/calculator.iml b/.idea/calculator.iml
new file mode 100644
index 0000000..c3cd732
--- /dev/null
+++ b/.idea/calculator.iml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..3c73ef2
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..6aa3d5c
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..94a25f7
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
new file mode 100644
index 0000000..f9f3350
--- /dev/null
+++ b/.idea/workspace.xml
@@ -0,0 +1,577 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Button
+ react
+
+
+ Screen
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+ DEFINITION_ORDER
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1536779576428
+
+
+ 1536779576428
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/README.md b/README.md
index 5bbfc5f..1d9e24f 100644
--- a/README.md
+++ b/README.md
@@ -1863,7 +1863,7 @@ If your production web server does not support HTTPS, then the service worker
registration will fail, but the rest of your web app will remain functional.
1. Service workers are [not currently supported](https://jakearchibald.github.io/isserviceworkerready/)
-in all web browsers. Service worker registration [won't be attempted](src/registerServiceWorker.js)
+in all web browsers. Service worker registration [won't be attempted](src/js/registerServiceWorker.js)
on browsers that lack support.
1. The service worker is only enabled in the [production environment](#deployment),
@@ -1897,7 +1897,7 @@ app works offline!" message) and also let them know when the service worker has
fetched the latest updates that will be available the next time they load the
page (showing a "New content is available; please refresh." message). Showing
this messages is currently left as an exercise to the developer, but as a
-starting point, you can make use of the logic included in [`src/registerServiceWorker.js`](src/registerServiceWorker.js), which
+starting point, you can make use of the logic included in [`src/registerServiceWorker.js`](src/js/registerServiceWorker.js), which
demonstrates which service worker lifecycle events to listen for to detect each
scenario, and which as a default, just logs appropriate messages to the
JavaScript console.
diff --git a/package-lock.json b/package-lock.json
index 92a7cc3..44451fe 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -4655,6 +4655,28 @@
"resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz",
"integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0="
},
+ "history": {
+ "version": "4.7.2",
+ "resolved": "https://registry.npmjs.org/history/-/history-4.7.2.tgz",
+ "integrity": "sha512-1zkBRWW6XweO0NBcjiphtVJVsIQ+SXF29z9DVkceeaSLVMFXHool+fdCZD4spDCfZJCILPILc3bm7Bc+HRi0nA==",
+ "requires": {
+ "invariant": "2.2.4",
+ "loose-envify": "1.4.0",
+ "resolve-pathname": "2.2.0",
+ "value-equal": "0.4.0",
+ "warning": "3.0.0"
+ },
+ "dependencies": {
+ "warning": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/warning/-/warning-3.0.0.tgz",
+ "integrity": "sha1-MuU3fLVy3kqwR1O9+IIcAe1gW3w=",
+ "requires": {
+ "loose-envify": "1.4.0"
+ }
+ }
+ }
+ },
"hmac-drbg": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz",
@@ -4665,6 +4687,11 @@
"minimalistic-crypto-utils": "1.0.1"
}
},
+ "hoist-non-react-statics": {
+ "version": "2.5.5",
+ "resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-2.5.5.tgz",
+ "integrity": "sha512-rqcy4pJo55FTTLWt+bU8ukscqHeE/e9KWvsOW2b/a3afxQZhwkQdT1rPPCJ0rYXdj4vNcasY8zHTH+jF/qStxw=="
+ },
"home-or-tmp": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/home-or-tmp/-/home-or-tmp-2.0.0.tgz",
@@ -8411,6 +8438,33 @@
"resolved": "https://registry.npmjs.org/react-error-overlay/-/react-error-overlay-4.0.1.tgz",
"integrity": "sha512-xXUbDAZkU08aAkjtUvldqbvI04ogv+a1XdHxvYuHPYKIVk/42BIOD0zSKTHAWV4+gDy3yGm283z2072rA2gdtw=="
},
+ "react-router": {
+ "version": "4.3.1",
+ "resolved": "https://registry.npmjs.org/react-router/-/react-router-4.3.1.tgz",
+ "integrity": "sha512-yrvL8AogDh2X42Dt9iknk4wF4V8bWREPirFfS9gLU1huk6qK41sg7Z/1S81jjTrGHxa3B8R3J6xIkDAA6CVarg==",
+ "requires": {
+ "history": "4.7.2",
+ "hoist-non-react-statics": "2.5.5",
+ "invariant": "2.2.4",
+ "loose-envify": "1.4.0",
+ "path-to-regexp": "1.7.0",
+ "prop-types": "15.6.2",
+ "warning": "4.0.2"
+ }
+ },
+ "react-router-dom": {
+ "version": "4.3.1",
+ "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-4.3.1.tgz",
+ "integrity": "sha512-c/MlywfxDdCp7EnB7YfPMOfMD3tOtIjrQlj/CKfNMBxdmpJP8xcz5P/UAFn3JbnQCNUxsHyVVqllF9LhgVyFCA==",
+ "requires": {
+ "history": "4.7.2",
+ "invariant": "2.2.4",
+ "loose-envify": "1.4.0",
+ "prop-types": "15.6.2",
+ "react-router": "4.3.1",
+ "warning": "4.0.2"
+ }
+ },
"react-scripts": {
"version": "1.1.5",
"resolved": "https://registry.npmjs.org/react-scripts/-/react-scripts-1.1.5.tgz",
@@ -8803,6 +8857,11 @@
"resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-1.0.1.tgz",
"integrity": "sha1-Jsv+k10a7uq7Kbw/5a6wHpPUQiY="
},
+ "resolve-pathname": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/resolve-pathname/-/resolve-pathname-2.2.0.tgz",
+ "integrity": "sha512-bAFz9ld18RzJfddgrO2e/0S2O81710++chRMUxHjXOYKF6jTAMrUNZrEZ1PvV0zlhfjidm08iRPdTLPno1FuRg=="
+ },
"resolve-url": {
"version": "0.2.1",
"resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz",
@@ -10163,6 +10222,11 @@
"spdx-expression-parse": "3.0.0"
}
},
+ "value-equal": {
+ "version": "0.4.0",
+ "resolved": "https://registry.npmjs.org/value-equal/-/value-equal-0.4.0.tgz",
+ "integrity": "sha512-x+cYdNnaA3CxvMaTX0INdTCN8m8aF2uY9BvEqmxuYp8bL09cs/kWVQPVGcA35fMktdOsP69IgU7wFj/61dJHEw=="
+ },
"vary": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
@@ -10199,6 +10263,14 @@
"makeerror": "1.0.11"
}
},
+ "warning": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/warning/-/warning-4.0.2.tgz",
+ "integrity": "sha512-wbTp09q/9C+jJn4KKJfJfoS6VleK/Dti0yqWSm6KMvJ4MRCXFQNapHuJXutJIrWV0Cf4AhTdeIe4qdKHR1+Hug==",
+ "requires": {
+ "loose-envify": "1.4.0"
+ }
+ },
"watch": {
"version": "0.10.0",
"resolved": "https://registry.npmjs.org/watch/-/watch-0.10.0.tgz",
diff --git a/package.json b/package.json
index ac1cf36..f841cd3 100644
--- a/package.json
+++ b/package.json
@@ -5,6 +5,7 @@
"dependencies": {
"react": "^16.5.0",
"react-dom": "^16.5.0",
+ "react-router-dom": "^4.3.1",
"react-scripts": "1.1.5"
},
"scripts": {
@@ -13,4 +14,4 @@
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
}
-}
\ No newline at end of file
+}
diff --git a/src/App.js b/src/App.js
deleted file mode 100644
index 203067e..0000000
--- a/src/App.js
+++ /dev/null
@@ -1,21 +0,0 @@
-import React, { Component } from 'react';
-import logo from './logo.svg';
-import './App.css';
-
-class App extends Component {
- render() {
- return (
-
-
-
- Welcome to React
-
-
- To get started, edit src/App.js and save to reload.
-
-
- );
- }
-}
-
-export default App;
diff --git a/src/App.css b/src/css/App.css
similarity index 100%
rename from src/App.css
rename to src/css/App.css
diff --git a/src/css/Button.css b/src/css/Button.css
new file mode 100644
index 0000000..3d6d8dc
--- /dev/null
+++ b/src/css/Button.css
@@ -0,0 +1,31 @@
+.square {
+ background: #fff;
+ border: 1px solid #999;
+ float: left;
+ font-size: 30px;
+ font-weight: bold;
+ line-height: 68px;
+ height: 68px;
+ margin-right: -1px;
+ margin-top: -1px;
+ padding: 0;
+ text-align: center;
+ width: 68px;
+}
+
+.square:focus {
+ outline: none;
+}
+
+.digit {
+ color: black;
+}
+
+.operation {
+ color: white;
+ background-color: salmon;
+}
+
+.double {
+ width: 136px;
+}
\ No newline at end of file
diff --git a/src/css/Screen.css b/src/css/Screen.css
new file mode 100644
index 0000000..dbf3637
--- /dev/null
+++ b/src/css/Screen.css
@@ -0,0 +1,19 @@
+.screen {
+ background: #433437;
+ color: white;
+ border: 1px solid #999;
+ float: left;
+ font-size: 24px;
+ font-weight: bold;
+ line-height: 68px;
+ height: 68px;
+ margin-right: -1px;
+ margin-top: -1px;
+ padding-right: 10px;
+ text-align: right;
+ width: 257px;
+}
+
+.screen:focus {
+ outline: none;
+}
\ No newline at end of file
diff --git a/src/css/index.css b/src/css/index.css
new file mode 100644
index 0000000..90fb4f1
--- /dev/null
+++ b/src/css/index.css
@@ -0,0 +1,43 @@
+body {
+ font: 14px "Century Gothic", Futura, sans-serif;
+ margin: 20px;
+}
+
+ol, ul {
+ padding-left: 30px;
+}
+
+.board-row:after {
+ clear: both;
+ content: "";
+ display: table;
+}
+
+.clear {
+ background: #fff;
+ border: 1px solid #999;
+ float: left;
+ font-size: 24px;
+ font-weight: bold;
+ line-height: 68px;
+ height: 68px;
+ margin-right: -1px;
+ margin-top: -1px;
+ padding: 0;
+ text-align: center;
+ width: 135px;
+}
+
+.clear:focus {
+ outline: none;
+}
+
+.kbd-navigation .square:focus {
+ background: #ddd;
+}
+
+.game {
+ display: flex;
+ flex-direction: row;
+}
+
diff --git a/src/index.css b/src/index.css
deleted file mode 100644
index b4cc725..0000000
--- a/src/index.css
+++ /dev/null
@@ -1,5 +0,0 @@
-body {
- margin: 0;
- padding: 0;
- font-family: sans-serif;
-}
diff --git a/src/index.js b/src/index.js
index fae3e35..21c8de8 100644
--- a/src/index.js
+++ b/src/index.js
@@ -1,8 +1,14 @@
import React from 'react';
import ReactDOM from 'react-dom';
-import './index.css';
-import App from './App';
-import registerServiceWorker from './registerServiceWorker';
+import './css/index.css';
+import App from './js/App';
+import { BrowserRouter } from 'react-router-dom'
+import registerServiceWorker from './js/registerServiceWorker';
+
+ReactDOM.render((
+
+
+
+), document.getElementById('root'));
-ReactDOM.render(, document.getElementById('root'));
registerServiceWorker();
diff --git a/src/js/App.js b/src/js/App.js
new file mode 100644
index 0000000..89c1de8
--- /dev/null
+++ b/src/js/App.js
@@ -0,0 +1,65 @@
+import React, { Component } from 'react';
+import '../css/App.css';
+import Calculator from "./Calculator";
+import BMI from "./BMI";
+import {Switch, Route, Link } from 'react-router-dom';
+
+class CalcWrapper extends React.Component {
+ render() {
+ return (
+
+ );
+ }
+}
+
+class BmiWrapper extends React.Component {
+ render() {
+ return (
+
+ );
+ }
+}
+
+const Home = () => (
+
+
Welcome to my calc!
+
+)
+
+const App = () => (
+
+
+
+
+);
+
+const Main = () => (
+
+
+
+
+
+
+
+);
+
+const Header = () => (
+
+);
+export default App;
diff --git a/src/App.test.js b/src/js/App.test.js
similarity index 100%
rename from src/App.test.js
rename to src/js/App.test.js
diff --git a/src/js/BMI.js b/src/js/BMI.js
new file mode 100644
index 0000000..7909570
--- /dev/null
+++ b/src/js/BMI.js
@@ -0,0 +1,78 @@
+import React from "react";
+import Button from "./Button";
+import Screen from "./Screen";
+import InputBlock from "./InputBlock";
+
+class BMI extends React.Component {
+ constructor(props){
+ super(props);
+ this.state = {
+ bmi_value: '',
+ kg: null,
+ cm: null,
+ };
+ }
+ handleCalculateClick(){
+ let cm = this.state.cm;
+ let kg = this.state.kg;
+
+ cm = this.validateInputParams(cm);
+ kg = this.validateInputParams(kg);
+
+ cm = this.centimeterToMeter(cm);
+
+ const bmi_value = kg / cm ** 2;
+ this.setState({bmi_value: bmi_value.toFixed(2)});
+ }
+
+ centimeterToMeter(cm){
+ return cm/100;
+ }
+
+ validateInputParams(param){
+ try {
+ return parseInt(param)
+ }
+ catch (e) {
+ this.setState({bmi_value: 'Wrong input'})
+ }
+ }
+
+ handleWeightInput = e => this.setState({kg: e.target.value});
+ handleHeightInput = e => this.setState({cm: e.target.value});
+
+ renderInputBlock(label, onChange){
+ return ;
+ }
+ renderButton(label) {
+ return