소스 검색

redacted App.js

RomanR 4 년 전
부모
커밋
bb4bc0332a
76개의 변경된 파일58556개의 추가작업 그리고 1개의 파일을 삭제
  1. 0 1
      LECTION38(project1)/App.js
  2. 23 0
      PROECT/proect/.gitignore
  3. 68 0
      PROECT/proect/README.md
  4. 13683 0
      PROECT/proect/package-lock.json
  5. 34 0
      PROECT/proect/package.json
  6. BIN
      PROECT/proect/public/favicon.ico
  7. 43 0
      PROECT/proect/public/index.html
  8. BIN
      PROECT/proect/public/logo192.png
  9. BIN
      PROECT/proect/public/logo512.png
  10. 25 0
      PROECT/proect/public/manifest.json
  11. 3 0
      PROECT/proect/public/robots.txt
  12. 42 0
      PROECT/proect/src/App.css
  13. 41 0
      PROECT/proect/src/App.js
  14. 9 0
      PROECT/proect/src/App.test.js
  15. 13 0
      PROECT/proect/src/index.css
  16. 17 0
      PROECT/proect/src/index.js
  17. 7 0
      PROECT/proect/src/logo.svg
  18. 141 0
      PROECT/proect/src/serviceWorker.js
  19. 5 0
      PROECT/proect/src/setupTests.js
  20. 23 0
      R01_Romanenko/hw1/.gitignore
  21. 68 0
      R01_Romanenko/hw1/README.md
  22. 13676 0
      R01_Romanenko/hw1/package-lock.json
  23. 34 0
      R01_Romanenko/hw1/package.json
  24. BIN
      R01_Romanenko/hw1/public/favicon.ico
  25. 43 0
      R01_Romanenko/hw1/public/index.html
  26. BIN
      R01_Romanenko/hw1/public/logo192.png
  27. BIN
      R01_Romanenko/hw1/public/logo512.png
  28. 25 0
      R01_Romanenko/hw1/public/manifest.json
  29. 3 0
      R01_Romanenko/hw1/public/robots.txt
  30. 45 0
      R01_Romanenko/hw1/src/App.css
  31. 477 0
      R01_Romanenko/hw1/src/App.js
  32. 9 0
      R01_Romanenko/hw1/src/App.test.js
  33. 13 0
      R01_Romanenko/hw1/src/index.css
  34. 17 0
      R01_Romanenko/hw1/src/index.js
  35. 7 0
      R01_Romanenko/hw1/src/logo.svg
  36. 141 0
      R01_Romanenko/hw1/src/serviceWorker.js
  37. 5 0
      R01_Romanenko/hw1/src/setupTests.js
  38. 340 0
      R01_Romanenko/lomov/App (7).js
  39. 185 0
      R01_Romanenko/lomov/App.css
  40. 68 0
      R01_Romanenko/try.js
  41. 23 0
      lection40/proect/.gitignore
  42. 68 0
      lection40/proect/README.md
  43. 13683 0
      lection40/proect/package-lock.json
  44. 34 0
      lection40/proect/package.json
  45. BIN
      lection40/proect/public/favicon.ico
  46. 43 0
      lection40/proect/public/index.html
  47. BIN
      lection40/proect/public/logo192.png
  48. BIN
      lection40/proect/public/logo512.png
  49. 25 0
      lection40/proect/public/manifest.json
  50. 3 0
      lection40/proect/public/robots.txt
  51. 53 0
      lection40/proect/src/App (map, key, render prop and so ).js
  52. 38 0
      lection40/proect/src/App.css
  53. 58 0
      lection40/proect/src/App.js
  54. 9 0
      lection40/proect/src/App.test.js
  55. 13 0
      lection40/proect/src/index.css
  56. 17 0
      lection40/proect/src/index.js
  57. 7 0
      lection40/proect/src/logo.svg
  58. 141 0
      lection40/proect/src/serviceWorker.js
  59. 5 0
      lection40/proect/src/setupTests.js
  60. 23 0
      my-project/.gitignore
  61. 68 0
      my-project/README.md
  62. 14534 0
      my-project/package-lock.json
  63. 36 0
      my-project/package.json
  64. BIN
      my-project/public/favicon.ico
  65. 43 0
      my-project/public/index.html
  66. BIN
      my-project/public/logo192.png
  67. BIN
      my-project/public/logo512.png
  68. 25 0
      my-project/public/manifest.json
  69. 3 0
      my-project/public/robots.txt
  70. 13 0
      my-project/src/App.js
  71. 74 0
      my-project/src/components/RegisterForm.js
  72. 13 0
      my-project/src/index.css
  73. 17 0
      my-project/src/index.js
  74. 141 0
      my-project/src/serviceWorker.js
  75. 8 0
      my-project/src/styles/App.css
  76. 5 0
      my-project/src/styles/RegisterForm.css

+ 0 - 1
LECTION38(project1)/App.js

@@ -5,7 +5,6 @@ import './App.css';
 const Header = (props) =>
 <header>
     {console.log(props)}
-  {console.log(props)}
     <img src={logo} className="App-logo" alt="logo" />
     <p>
     {props.children}

+ 23 - 0
PROECT/proect/.gitignore

@@ -0,0 +1,23 @@
+# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
+
+# dependencies
+/node_modules
+/.pnp
+.pnp.js
+
+# testing
+/coverage
+
+# production
+/build
+
+# misc
+.DS_Store
+.env.local
+.env.development.local
+.env.test.local
+.env.production.local
+
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*

+ 68 - 0
PROECT/proect/README.md

@@ -0,0 +1,68 @@
+This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
+
+## Available Scripts
+
+In the project directory, you can run:
+
+### `npm start`
+
+Runs the app in the development mode.<br />
+Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
+
+The page will reload if you make edits.<br />
+You will also see any lint errors in the console.
+
+### `npm test`
+
+Launches the test runner in the interactive watch mode.<br />
+See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
+
+### `npm run build`
+
+Builds the app for production to the `build` folder.<br />
+It correctly bundles React in production mode and optimizes the build for the best performance.
+
+The build is minified and the filenames include the hashes.<br />
+Your app is ready to be deployed!
+
+See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
+
+### `npm run eject`
+
+**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
+
+If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
+
+Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
+
+You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
+
+## Learn More
+
+You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
+
+To learn React, check out the [React documentation](https://reactjs.org/).
+
+### Code Splitting
+
+This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting
+
+### Analyzing the Bundle Size
+
+This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size
+
+### Making a Progressive Web App
+
+This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app
+
+### Advanced Configuration
+
+This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration
+
+### Deployment
+
+This section has moved here: https://facebook.github.io/create-react-app/docs/deployment
+
+### `npm run build` fails to minify
+
+This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 13683 - 0
PROECT/proect/package-lock.json


+ 34 - 0
PROECT/proect/package.json

@@ -0,0 +1,34 @@
+{
+  "name": "proect",
+  "version": "0.1.0",
+  "private": true,
+  "dependencies": {
+    "@testing-library/jest-dom": "^4.2.4",
+    "@testing-library/react": "^9.5.0",
+    "@testing-library/user-event": "^7.2.1",
+    "react": "^16.13.1",
+    "react-dom": "^16.13.1",
+    "react-scripts": "3.4.3"
+  },
+  "scripts": {
+    "start": "react-scripts start",
+    "build": "react-scripts build",
+    "test": "react-scripts test",
+    "eject": "react-scripts eject"
+  },
+  "eslintConfig": {
+    "extends": "react-app"
+  },
+  "browserslist": {
+    "production": [
+      ">0.2%",
+      "not dead",
+      "not op_mini all"
+    ],
+    "development": [
+      "last 1 chrome version",
+      "last 1 firefox version",
+      "last 1 safari version"
+    ]
+  }
+}

BIN
PROECT/proect/public/favicon.ico


+ 43 - 0
PROECT/proect/public/index.html

@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+<html lang="en">
+  <head>
+    <meta charset="utf-8" />
+    <link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
+    <meta name="viewport" content="width=device-width, initial-scale=1" />
+    <meta name="theme-color" content="#000000" />
+    <meta
+      name="description"
+      content="Web site created using create-react-app"
+    />
+    <link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
+    <!--
+      manifest.json provides metadata used when your web app is installed on a
+      user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
+    -->
+    <link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
+    <!--
+      Notice the use of %PUBLIC_URL% in the tags above.
+      It will be replaced with the URL of the `public` folder during the build.
+      Only files inside the `public` folder can be referenced from the HTML.
+
+      Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
+      work correctly both with client-side routing and a non-root public URL.
+      Learn how to configure a non-root public URL by running `npm run build`.
+    -->
+    <title>React App</title>
+  </head>
+  <body>
+    <noscript>You need to enable JavaScript to run this app.</noscript>
+    <div id="root"></div>
+    <!--
+      This HTML file is a template.
+      If you open it directly in the browser, you will see an empty page.
+
+      You can add webfonts, meta tags, or analytics to this file.
+      The build step will place the bundled scripts into the <body> tag.
+
+      To begin the development, run `npm start` or `yarn start`.
+      To create a production bundle, use `npm run build` or `yarn build`.
+    -->
+  </body>
+</html>

BIN
PROECT/proect/public/logo192.png


BIN
PROECT/proect/public/logo512.png


+ 25 - 0
PROECT/proect/public/manifest.json

@@ -0,0 +1,25 @@
+{
+  "short_name": "React App",
+  "name": "Create React App Sample",
+  "icons": [
+    {
+      "src": "favicon.ico",
+      "sizes": "64x64 32x32 24x24 16x16",
+      "type": "image/x-icon"
+    },
+    {
+      "src": "logo192.png",
+      "type": "image/png",
+      "sizes": "192x192"
+    },
+    {
+      "src": "logo512.png",
+      "type": "image/png",
+      "sizes": "512x512"
+    }
+  ],
+  "start_url": ".",
+  "display": "standalone",
+  "theme_color": "#000000",
+  "background_color": "#ffffff"
+}

+ 3 - 0
PROECT/proect/public/robots.txt

@@ -0,0 +1,3 @@
+# https://www.robotstxt.org/robotstxt.html
+User-agent: *
+Disallow:

+ 42 - 0
PROECT/proect/src/App.css

@@ -0,0 +1,42 @@
+.App {
+  text-align: center;
+}
+
+.App-logo {
+  height: 40vmin;
+  pointer-events: none;
+}
+
+@media (prefers-reduced-motion: no-preference) {
+  .App-logo {
+    animation: App-logo-spin infinite 20s linear;
+  }
+}
+
+.App-header {
+  background-color: #282c34;
+  min-height: 100vh;
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  justify-content: center;
+  font-size: calc(10px + 2vmin);
+  color: white;
+}
+
+.App-link {
+  color: #61dafb;
+}
+#registration{
+  display: flex;
+  flex-direction:column;
+}
+
+@keyframes App-logo-spin {
+  from {
+    transform: rotate(0deg);
+  }
+  to {
+    transform: rotate(360deg);
+  }
+}

+ 41 - 0
PROECT/proect/src/App.js

@@ -0,0 +1,41 @@
+import React, { useState } from 'react';
+import logo from './logo.svg';
+import './App.css';
+
+
+const Registration = ({ login, password, confirmPassword }) => {
+  const [log, setLog] = useState('login')
+  const [pass, setPass] = useState('password')
+  const [confPass, setConfPass] = useState('Confirm password')
+
+  return (
+    <div id='registration'>
+      <h2>Registration</h2>
+      <label>Login<input type='text' value={log} placeholder='Login'
+        style={{ backgroundColor: log.length <= 2 || log.length >= 10 ? '#FAA' : '' }}
+        onChange={(e) => setLog(e.target.value)}
+      /></label>
+      <label style={{ margin: 10 }}>Password<input type='text' placeholder='Password'
+        value={pass} style={{ backgroundColor: pass.length <= 2 || pass !== confPass || pass.match(/[0-9]+/gi) ? '#FAA' : '' }}
+        onChange={(e) => setPass(e.target.value)}
+      /></label>
+      <label style={{ margin: 10 }}>Confirm password<input type='text' placeholder='Confirm password'
+        value={confPass} style={{ backgroundColor: confPass.length <= 2 || confPass !== pass || confPass.match(/[0-9]+/gi) ? '#FAA' : '' }}
+        onChange={(e) => setConfPass(e.target.value)}
+      /></label>
+    </div>
+  )
+}
+
+function App() {
+  return (
+    <div className="App">
+      <header className="App-header">
+        <img src={logo} className="App-logo" alt="logo" />
+        <Registration />
+      </header>
+    </div>
+  );
+}
+
+export default App;

+ 9 - 0
PROECT/proect/src/App.test.js

@@ -0,0 +1,9 @@
+import React from 'react';
+import { render } from '@testing-library/react';
+import App from './App';
+
+test('renders learn react link', () => {
+  const { getByText } = render(<App />);
+  const linkElement = getByText(/learn react/i);
+  expect(linkElement).toBeInTheDocument();
+});

+ 13 - 0
PROECT/proect/src/index.css

@@ -0,0 +1,13 @@
+body {
+  margin: 0;
+  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
+    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
+    sans-serif;
+  -webkit-font-smoothing: antialiased;
+  -moz-osx-font-smoothing: grayscale;
+}
+
+code {
+  font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
+    monospace;
+}

+ 17 - 0
PROECT/proect/src/index.js

@@ -0,0 +1,17 @@
+import React from 'react';
+import ReactDOM from 'react-dom';
+import './index.css';
+import App from './App';
+import * as serviceWorker from './serviceWorker';
+
+ReactDOM.render(
+  <React.StrictMode>
+    <App />
+  </React.StrictMode>,
+  document.getElementById('root')
+);
+
+// If you want your app to work offline and load faster, you can change
+// unregister() to register() below. Note this comes with some pitfalls.
+// Learn more about service workers: https://bit.ly/CRA-PWA
+serviceWorker.unregister();

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 7 - 0
PROECT/proect/src/logo.svg


+ 141 - 0
PROECT/proect/src/serviceWorker.js

@@ -0,0 +1,141 @@
+// This optional code is used to register a service worker.
+// register() is not called by default.
+
+// This lets the app load faster on subsequent visits in production, and gives
+// it offline capabilities. However, it also means that developers (and users)
+// will only see deployed updates on subsequent visits to a page, after all the
+// existing tabs open on the page have been closed, since previously cached
+// resources are updated in the background.
+
+// To learn more about the benefits of this model and instructions on how to
+// opt-in, read https://bit.ly/CRA-PWA
+
+const isLocalhost = Boolean(
+  window.location.hostname === 'localhost' ||
+    // [::1] is the IPv6 localhost address.
+    window.location.hostname === '[::1]' ||
+    // 127.0.0.0/8 are considered localhost for IPv4.
+    window.location.hostname.match(
+      /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/
+    )
+);
+
+export function register(config) {
+  if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {
+    // The URL constructor is available in all browsers that support SW.
+    const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href);
+    if (publicUrl.origin !== window.location.origin) {
+      // Our service worker won't work if PUBLIC_URL is on a different origin
+      // from what our page is served on. This might happen if a CDN is used to
+      // serve assets; see https://github.com/facebook/create-react-app/issues/2374
+      return;
+    }
+
+    window.addEventListener('load', () => {
+      const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;
+
+      if (isLocalhost) {
+        // This is running on localhost. Let's check if a service worker still exists or not.
+        checkValidServiceWorker(swUrl, config);
+
+        // Add some additional logging to localhost, pointing developers to the
+        // service worker/PWA documentation.
+        navigator.serviceWorker.ready.then(() => {
+          console.log(
+            'This web app is being served cache-first by a service ' +
+              'worker. To learn more, visit https://bit.ly/CRA-PWA'
+          );
+        });
+      } else {
+        // Is not localhost. Just register service worker
+        registerValidSW(swUrl, config);
+      }
+    });
+  }
+}
+
+function registerValidSW(swUrl, config) {
+  navigator.serviceWorker
+    .register(swUrl)
+    .then(registration => {
+      registration.onupdatefound = () => {
+        const installingWorker = registration.installing;
+        if (installingWorker == null) {
+          return;
+        }
+        installingWorker.onstatechange = () => {
+          if (installingWorker.state === 'installed') {
+            if (navigator.serviceWorker.controller) {
+              // At this point, the updated precached content has been fetched,
+              // but the previous service worker will still serve the older
+              // content until all client tabs are closed.
+              console.log(
+                'New content is available and will be used when all ' +
+                  'tabs for this page are closed. See https://bit.ly/CRA-PWA.'
+              );
+
+              // Execute callback
+              if (config && config.onUpdate) {
+                config.onUpdate(registration);
+              }
+            } else {
+              // At this point, everything has been precached.
+              // It's the perfect time to display a
+              // "Content is cached for offline use." message.
+              console.log('Content is cached for offline use.');
+
+              // Execute callback
+              if (config && config.onSuccess) {
+                config.onSuccess(registration);
+              }
+            }
+          }
+        };
+      };
+    })
+    .catch(error => {
+      console.error('Error during service worker registration:', error);
+    });
+}
+
+function checkValidServiceWorker(swUrl, config) {
+  // Check if the service worker can be found. If it can't reload the page.
+  fetch(swUrl, {
+    headers: { 'Service-Worker': 'script' },
+  })
+    .then(response => {
+      // Ensure service worker exists, and that we really are getting a JS file.
+      const contentType = response.headers.get('content-type');
+      if (
+        response.status === 404 ||
+        (contentType != null && contentType.indexOf('javascript') === -1)
+      ) {
+        // No service worker found. Probably a different app. Reload the page.
+        navigator.serviceWorker.ready.then(registration => {
+          registration.unregister().then(() => {
+            window.location.reload();
+          });
+        });
+      } else {
+        // Service worker found. Proceed as normal.
+        registerValidSW(swUrl, config);
+      }
+    })
+    .catch(() => {
+      console.log(
+        'No internet connection found. App is running in offline mode.'
+      );
+    });
+}
+
+export function unregister() {
+  if ('serviceWorker' in navigator) {
+    navigator.serviceWorker.ready
+      .then(registration => {
+        registration.unregister();
+      })
+      .catch(error => {
+        console.error(error.message);
+      });
+  }
+}

+ 5 - 0
PROECT/proect/src/setupTests.js

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

+ 23 - 0
R01_Romanenko/hw1/.gitignore

@@ -0,0 +1,23 @@
+# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
+
+# dependencies
+/node_modules
+/.pnp
+.pnp.js
+
+# testing
+/coverage
+
+# production
+/build
+
+# misc
+.DS_Store
+.env.local
+.env.development.local
+.env.test.local
+.env.production.local
+
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*

+ 68 - 0
R01_Romanenko/hw1/README.md

@@ -0,0 +1,68 @@
+This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
+
+## Available Scripts
+
+In the project directory, you can run:
+
+### `npm start`
+
+Runs the app in the development mode.<br />
+Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
+
+The page will reload if you make edits.<br />
+You will also see any lint errors in the console.
+
+### `npm test`
+
+Launches the test runner in the interactive watch mode.<br />
+See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
+
+### `npm run build`
+
+Builds the app for production to the `build` folder.<br />
+It correctly bundles React in production mode and optimizes the build for the best performance.
+
+The build is minified and the filenames include the hashes.<br />
+Your app is ready to be deployed!
+
+See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
+
+### `npm run eject`
+
+**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
+
+If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
+
+Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
+
+You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
+
+## Learn More
+
+You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
+
+To learn React, check out the [React documentation](https://reactjs.org/).
+
+### Code Splitting
+
+This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting
+
+### Analyzing the Bundle Size
+
+This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size
+
+### Making a Progressive Web App
+
+This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app
+
+### Advanced Configuration
+
+This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration
+
+### Deployment
+
+This section has moved here: https://facebook.github.io/create-react-app/docs/deployment
+
+### `npm run build` fails to minify
+
+This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 13676 - 0
R01_Romanenko/hw1/package-lock.json


+ 34 - 0
R01_Romanenko/hw1/package.json

@@ -0,0 +1,34 @@
+{
+  "name": "hw1",
+  "version": "0.1.0",
+  "private": true,
+  "dependencies": {
+    "@testing-library/jest-dom": "^4.2.4",
+    "@testing-library/react": "^9.5.0",
+    "@testing-library/user-event": "^7.2.1",
+    "react": "^16.13.1",
+    "react-dom": "^16.13.1",
+    "react-scripts": "3.4.3"
+  },
+  "scripts": {
+    "start": "react-scripts start",
+    "build": "react-scripts build",
+    "test": "react-scripts test",
+    "eject": "react-scripts eject"
+  },
+  "eslintConfig": {
+    "extends": "react-app"
+  },
+  "browserslist": {
+    "production": [
+      ">0.2%",
+      "not dead",
+      "not op_mini all"
+    ],
+    "development": [
+      "last 1 chrome version",
+      "last 1 firefox version",
+      "last 1 safari version"
+    ]
+  }
+}

BIN
R01_Romanenko/hw1/public/favicon.ico


+ 43 - 0
R01_Romanenko/hw1/public/index.html

@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+<html lang="en">
+  <head>
+    <meta charset="utf-8" />
+    <link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
+    <meta name="viewport" content="width=device-width, initial-scale=1" />
+    <meta name="theme-color" content="#000000" />
+    <meta
+      name="description"
+      content="Web site created using create-react-app"
+    />
+    <link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
+    <!--
+      manifest.json provides metadata used when your web app is installed on a
+      user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
+    -->
+    <link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
+    <!--
+      Notice the use of %PUBLIC_URL% in the tags above.
+      It will be replaced with the URL of the `public` folder during the build.
+      Only files inside the `public` folder can be referenced from the HTML.
+
+      Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
+      work correctly both with client-side routing and a non-root public URL.
+      Learn how to configure a non-root public URL by running `npm run build`.
+    -->
+    <title>React App</title>
+  </head>
+  <body>
+    <noscript>You need to enable JavaScript to run this app.</noscript>
+    <div id="root"></div>
+    <!--
+      This HTML file is a template.
+      If you open it directly in the browser, you will see an empty page.
+
+      You can add webfonts, meta tags, or analytics to this file.
+      The build step will place the bundled scripts into the <body> tag.
+
+      To begin the development, run `npm start` or `yarn start`.
+      To create a production bundle, use `npm run build` or `yarn build`.
+    -->
+  </body>
+</html>

BIN
R01_Romanenko/hw1/public/logo192.png


BIN
R01_Romanenko/hw1/public/logo512.png


+ 25 - 0
R01_Romanenko/hw1/public/manifest.json

@@ -0,0 +1,25 @@
+{
+  "short_name": "React App",
+  "name": "Create React App Sample",
+  "icons": [
+    {
+      "src": "favicon.ico",
+      "sizes": "64x64 32x32 24x24 16x16",
+      "type": "image/x-icon"
+    },
+    {
+      "src": "logo192.png",
+      "type": "image/png",
+      "sizes": "192x192"
+    },
+    {
+      "src": "logo512.png",
+      "type": "image/png",
+      "sizes": "512x512"
+    }
+  ],
+  "start_url": ".",
+  "display": "standalone",
+  "theme_color": "#000000",
+  "background_color": "#ffffff"
+}

+ 3 - 0
R01_Romanenko/hw1/public/robots.txt

@@ -0,0 +1,3 @@
+# https://www.robotstxt.org/robotstxt.html
+User-agent: *
+Disallow:

+ 45 - 0
R01_Romanenko/hw1/src/App.css

@@ -0,0 +1,45 @@
+.App {
+  text-align: center;
+}
+
+.App-logo {
+  height: 40vmin;
+  pointer-events: none;
+}
+
+@media (prefers-reduced-motion: no-preference) {
+  .App-logo {
+    animation: App-logo-spin infinite 20s linear;
+  }
+}
+
+.App-header {
+  background-color: #282c34;
+  min-height: 100vh;
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  justify-content: center;
+  font-size: calc(10px + 2vmin);
+  color: white;
+}
+
+.App-link {
+  color: #61dafb;
+}
+
+@keyframes App-logo-spin {
+  from {
+    transform: rotate(0deg);
+  }
+  to {
+    transform: rotate(360deg);
+  }
+}
+
+.PasswordConfirm {
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  margin: 10px;
+}

+ 477 - 0
R01_Romanenko/hw1/src/App.js

@@ -0,0 +1,477 @@
+import React, { useState, useEffect } from 'react';
+import './App.css';
+// import logo from './logo.svg';
+
+
+// Spoiler
+const Spoiler = ({ header = "+", open, children }) => {
+  // console.log(header, open, children)
+  // { console.log(open) };
+  const [state, setState] = useState(open)
+  return (
+    <div>
+      <div onClick={() => setState(!state)}>
+        {header}
+      </div>
+      {/* <div style={{ visibility: !state ? 'hidden' : 'visible' }}> */}
+      {state && children}
+      {/* </div> */}
+    </div>
+  )
+}
+
+const RangeInput = ({ max, min }) => {
+  // console.log({ min });
+  // console.log({ max });
+
+  const [Text, setText] = useState('');
+  return (
+    <div>
+      <h2>RangeInput</h2>
+      <label>{Text} <input type='text' value={Text}
+        style={{ backgroundColor: Text.length <= min || Text.length >= max ? '#FAA' : '' }}
+        onChange={(e) => setText(e.target.value)}
+      /></label>
+    </div>
+  );
+};
+
+
+// PasswordConfirm
+const PasswordConfirm = ({ min }) => {
+  const [Pass, setPass] = useState('123')
+  const [confPass, setconfPass] = useState('123')
+  const [eye, setEye] = useState(false)
+  // { eye? Pass.type='text' : '' }
+  return (
+    <div>
+      <h2>PasswordConfirm</h2>
+      <div className="PasswordConfirm">
+        <label style={{ margin: 10 }}>Password<input
+          type={eye ? 'text' : 'password'}
+          value={Pass} style={{ backgroundColor: Pass.length <= min || Pass !== confPass || Pass.match(/[0-9]+/gi) ? '#FAA' : '' }}
+          onChange={(e) => setPass(e.target.value)}
+        /><button style={{ color: eye ? 'grey' : '' }} onClick={(e) => setEye(!eye)}>&#128065;</button></label>
+
+        <label style={{ margin: 10 }}>Confirm password<input type={eye ? 'text' : 'password'}
+          value={confPass} style={{ backgroundColor: confPass.length <= min || confPass !== Pass || confPass.match(/[0-9]+/gi) ? '#FAA' : '' }}
+          onChange={(e) => setconfPass(e.target.value)}
+        /><button style={{ color: eye ? 'grey' : '' }} onClick={(e) => setEye(!eye)}>&#128065;</button></label>
+      </div>
+    </div>
+  )
+}
+
+// const TimerControl = ({sec, children}) => {
+//   const [hour, setHour] = useState(0);
+//   const [minute, setMin] = useState(0);
+//   const [second, setSec] = useState(0);
+//   const [timer, setTimer] = useState(false);
+//   const [pause, setPause] = useState(false);
+//   const [time, setTime] = useState(0);
+//   const [stop, setStop] = useState(false);
+//   console.log(time);
+
+//   let a = setTimeout(() => setTime(time - 1), 1000);
+//   if (time <= 0 || pause === true || stop) {
+//       clearTimeout(a);
+//   }
+
+//   let test = new Date(+time * 1000);
+
+//   if (timer === true ) {
+//       return (
+//           <div>
+//               <label>
+//                   <input type="text"
+//                          placeholder='hour'
+//                          value={hour}
+//                          onChange={(e) => setHour(e.target.value)}
+//                   />
+//               </label>
+//               <label>
+//                   <input type="text"
+//                          placeholder='minute'
+//                          value={minute}
+//                          onChange={(e) => setMin(e.target.value)}
+//                   />
+//               </label>
+//               <label>
+//                   <input type="text"
+//                          placeholder='second'
+//                          value={second}
+//                          onChange={(e) => setSec(e.target.value)}
+//                   />
+//               </label>
+//               <button onClick={(e) => {
+//                   setTimer(!timer)
+//                   setStop(true)
+//               }
+//               }>Stop</button>
+//               <div>
+//                   <input
+//                       type='text'
+//                       readOnly
+//                       value={+test.getUTCHours() + ':' + +test.getMinutes() + ':' + +test.getSeconds()}/>
+//                   <button onClick={
+//                       (e) => setPause(!pause)
+//                   }>Pause</button>
+//               </div>
+//           </div>
+//       )
+//   } else {
+//       return (
+//           <div>
+//               <label>
+//                   <input type="text"
+//                          placeholder='hour'
+//                          value={hour}
+//                          onChange={(e) => setHour(e.target.value)}
+//                   />
+//               </label>
+//               <label>
+//                   <input type="text"
+//                          placeholder='minute'
+//                          value={minute}
+//                          onChange={(e) => setMin(e.target.value)}
+//                   />
+//               </label>
+//               <label>
+//                   <input type="text"
+//                          placeholder='second'
+//                          value={second}
+//                          onChange={(e) => setSec(e.target.value)}
+//                   />
+//               </label>
+//               <button onClick={(e) => {
+//                   setTimer(!timer)
+//                   setTime((+second) + (+minute*60)+ (+hour*60*60));
+//                   setStop(false)
+//               }}>Start</button>
+//           </div>
+//       )
+//   }
+// };
+
+// const Timer = (props) => {
+//   const [time, setTime] = useState(props.sec);
+//   const [pause, setPause] = useState(true);
+
+//   let seconds = time % 60;
+//   let minutes = Math.floor((time / 60) % 60);
+//   let hours = Math.floor(time / 3600);
+
+//   let interval;
+
+//   var t1 = performance.now();
+//   let st;
+
+//   useEffect(() => {
+//     // let st;
+//     interval = setInterval(() => {
+//       if (!pause) {
+//         var t2 = performance.now();
+//         st = t2 - t1;
+//         // setTime((t2, t1) => t2 - t1);
+//         setTime((time) => time - 1);
+//         console.log(t2);
+//       }
+//     }, props.refresh);
+//     return () => clearInterval(interval);
+//   }, [pause]);
+//   return (
+//     <div>
+//       <span>
+//         Timer: {hours}:{minutes}:{seconds}
+//       </span>
+//       <button id="pause" onClick={() => setPause(!pause)}>
+//         {/* &#10074;&#10074; */}
+//         {pause ? "\u25BA" : "\u275A\u275A"}
+//       </button>
+//     </div>
+//   );
+// };
+
+// // Timer
+// const TimerSec = ({ sec, refs }) => {
+//   // console.log({ sec });
+//   const [time, setTime] = useState(sec);
+//   // const [minute, setMin] = useState(0);
+//   // const [hours, setHrs] = useState(0);
+
+//   const [pause, setPause] = useState(false);
+//   {
+
+//     let interval;
+
+//     // var t1 = performance.now();
+//     // let st;
+
+//     // useEffect(() => {
+//     //   // let st;
+//     //   interval = setInterval(() => {
+//     //     if (!pause) {
+//     //       var t2 = performance.now();
+//     //       st = t2 - t1;
+//     //       // setTime((t2, t1) => t2 - t1);
+//     //       setTime((time) => time - 1);
+//     //       console.log(t2);
+//     //     }
+//     //   }, props.refresh);
+//     //   return () => clearInterval(interval);
+//     // }, [pause]);
+
+//     // minute = time / 3600
+//     // minute > 0.5 ? console.log('yes') : console.log('no')
+//     // time/3600>=1? 
+//     var date = new Date(time * 1000);
+//     // let start = performance.now();
+//     // let stop;
+//     useEffect(() => {
+//       intervail = setInterval(() => (pause || time === 0) ? time : setTime(time - 1), refs);
+//       stop = performance.now();
+//     },
+
+//     // let duration = stop - start
+
+//       // setTimeout(() => (pause || time === 0) ? time : setTime(time - 1), refs);
+//       // let duration = performance.now()-start;
+//       // console.log(duration)
+//   }
+//   return (
+//     <div>
+//       <h2>Timer</h2>
+//       <span id='timer'>{date.getUTCHours() + ':' + date.getUTCMinutes() + ':' + date.getUTCSeconds()}</span>
+//       {/* <span id='timer'>{hours}:{minute}:{time}</span> */}
+//       <button style={{ backgroundColor: pause ? 'green' : '' }}
+//         onClick={() => { setPause(!pause); console.log({ pause }) }}> &#9208;
+//       </button>
+//     </div >
+//   )
+// };
+
+
+// const Timer = (props) => {
+//   const [time, setTime] = useState(props.sec);
+//   console.log("props.sec: ", props.sec);
+//   const [pause, setPause] = useState(true);
+
+//   let seconds = time % 60;
+//   let minutes = Math.floor((time / 60) % 60);
+//   let hours = Math.floor(time / 3600);
+
+//   let interval;
+
+//   useEffect(() => {
+//     interval = setInterval(() => {
+//       if (!pause) {
+//         setTime((time) => time - 1);
+//         // console.log("interval: " + interval);
+//       }
+//     }, props.refresh);
+//     return () => clearInterval(interval);
+//   }, [pause]);
+
+//   return (
+//     <div>
+//       <span>
+//         Timer: {hours}:{minutes}:{Math.trunc(seconds)}
+//       </span>
+//       <button id="pause" onClick={() => setPause(!pause)}>
+//         {/* &#10074;&#10074; */}
+//         {pause ? "\u25BA" : "\u275A\u275A"}
+//       </button>
+//     </div>
+//   );
+// };
+
+ // Timer
+const TimerSec = ({ sec, refs }) => {
+  const [time, setTime] = useState(sec);
+
+  const [pause, setPause] = useState(false);
+  {
+
+    var date = new Date(time * 1000);
+    let now;
+    useEffect(() => {
+      // setTimeout(() => (pause || time === 0) ? time : setTime(time - 1), refs);
+      setTimeout(() => (pause || time === 0) ? time : setTime(time - 1), refs);
+    }, refs)
+  }
+  return (
+    <div>
+      <h2>Timer</h2>
+     {/* <span> {hours}:{minutes}:{Math.trunc(seconds)} </span> */}
+      <span id='timer'>{date.getUTCHours() + ':' + date.getUTCMinutes() + ':' + date.getUTCSeconds()}</span>
+      {/* <span id='timer'>{hours}:{minute}:{time}</span> */}
+      <button style={{ backgroundColor: pause ? 'green' : '' }}
+        onClick={() => { setPause(!pause); console.log({ pause }) }}> &#9208;
+      </button>
+    </div >
+  )
+};
+
+// Timer
+const TimerControl = ({ sec }) => {
+  // console.log({ sec });
+  const [time, setTime] = useState(0);
+  const [minute, setMin] = useState(0);
+  const [hours, setHrs] = useState(0);
+
+
+  const [pause, setPause] = useState(false);
+  const [start, setStart] = useState(false);
+  const [stop, setStop] = useState(false);
+
+  {
+    var date = new Date(time * 1000);
+    // let timeout = setTimeout(() => setTime(time - 1), 1000);
+    // if (time <= 0 || pause || stop) {
+    //   // if (time <= 0 || pause === true ) {
+    //   clearTimeout(timeout);
+    // }
+    // let timeout = setTimeout(() => (pause || time === 0) ? date.getUTCHours() + ':' 
+    // + date.getUTCMinutes() + ':' + date.getUTCSeconds() : setTime(time - 1), 1000);
+    // if (time <= 0 || pause || stop) {
+    //   // if (time <= 0 || pause === true ) {
+    //   clearTimeout(timeout);
+    // }
+
+    let timeout = setTimeout(() =>
+      (time <= 0 || pause || stop) ? clearTimeout(timeout) : setTime(time - 1), 1000);
+    if (start) {
+      return (
+        <div>
+          <h2>Timer</h2>
+          <label htmlFor="">Hours : <input type="text" value={hours} onChange={(e) => setHrs(e.target.value)} /></label>
+          <label htmlFor="">Minutes : <input type="text" value={minute} onChange={(e) => setMin(e.target.value)} /></label>
+          <label htmlFor="">Seconds : <input type="text" value={time} onChange={(e) => setTime(e.target.value)} /></label>
+          <span id='timer'>{date.getUTCHours() + ':' + date.getUTCMinutes() + ':' + date.getUTCSeconds()}</span>
+          <button
+            style={{ backgroundColor: pause ? 'green' : '' }}
+            onClick={() => setPause(!pause)}> &#9208;
+          </button>
+          {/* <button 
+          style={{ backgroundColor: stop ? 'orange' : '' }}
+            onClick={() => {
+              setPause(start);
+              setStop(true)
+            }}
+          > Stop </button> */}
+
+          <button style={{ backgroundColor: stop ? 'orange' : '' }}
+            onClick={() => {
+              setStart(!start)
+              setStop(true)
+            }}>Stop</button>
+        </div>
+      )
+    }
+    else if (!start) {
+      return (
+        <div>
+          <h2>Timer</h2>
+          <label htmlFor="">Hours : <input type="text" value={hours} onChange={(e) => setHrs(e.target.value)} /></label>
+          <label htmlFor="">Minutes : <input type="text" value={minute} onChange={(e) => setMin(e.target.value)} /></label>
+          <label htmlFor="">Seconds : <input type="text" value={time} onChange={(e) => setTime(e.target.value)} /></label>
+          {/* <button 
+          style={{ backgroundColor: start ? 'green' : '' }}
+            onClick={() => {
+              setStart(!start);
+              setTime((+time) + (+minute * 60) + (+hours * 60 * 60));
+              setStop(false)
+            }}> Start
+          </button> */}
+          <button
+            style={{ backgroundColor: start ? 'green' : '' }}
+            onClick={() => {
+              setStart(!start);
+              setTime((+time) + (+minute * 60) + (+hours * 60 * 60));
+              setStop(false)
+            }}>Start</button>
+        </div>
+      )
+    }
+  }
+};
+
+
+
+
+
+
+// TimerContainer
+const SecondsTimer = ({ seconds }) => <h2>{seconds}</h2>
+
+
+// const TimerContainer = ({ seconds, refresh, render: Render }) => {
+//   const [start, setStart] = useState(performance.now())
+//   // const [time, setTime] = useState(seconds)
+//   const now = performance.now()
+//   useEffect(() => {
+//     // setInterval(() => (seconds ===0)? seconds : setStart(seconds-1), refresh)
+//     // let interval = setInterval(() => (time === 0) ? time : setTime(time - 1), refresh)
+//     let interval = setInterval(() => (start === 0) ? Math.random() : setStart(start - 1), refresh)
+//     return () => clearInterval(interval)
+//   }, [start]);
+//   return (<Render seconds={seconds - (now - start)} />)
+// }
+
+
+const TimerContainer = ({ seconds, refresh, render: Render }) => {
+  const [start, setStart] = useState(performance.now())
+  // const [forget, setForget] = useState() 
+  useEffect(() => {
+    let interval = setInterval(() => (seconds === 0) ? seconds : setStart(seconds - 1), refresh)
+    return () => clearInterval(interval)
+  }, [start]);
+  const now = performance.now()
+  {/* так как омпонет функция, то мы можем функция передать в другой компонент */ }
+  return (<Render seconds={seconds - (now - start)} />)
+}
+
+
+function App() {
+  return (
+    <div className="App">
+      <Spoiler header={<h1>Заголовок</h1>} open>
+        <h2>Контент 1</h2>
+        <p>
+          Lorem ipsum dolor sit, amet consectetur adipisicing elit. Rerum quae
+          molestiae recusandae repellendus sequi quod nam? Ullam ipsum enim, iure laboriosam unde
+          tempore similique quasi culpa perferendis temporibus perspiciatis! Aut?Esse necessitatibus
+          quam labore vero libero assumenda reprehenderit dolore optio dolorem dignissimos quisquam
+          magni nisi, aliquam quis, pariatur accusanti
+          officiis exercitationem tempora adipisci. Voluptas nam sint, aut aspernatur est non.
+        </p>
+      </Spoiler>
+      <Spoiler>
+        <h2>Контент 2</h2>
+        <p>
+          Lorem ipsum dolor sit amet consectetur, adipisicing elit. Magni, minus.
+          Atque maxime quam, dolorum enim aspernatur voluptatibus ad amet ex!
+          Quo voluptatem ducimus dolorem fugit sequi doloremque nulla dolor
+          repellat!Eveniet perferendis suscipit ex quae adipisci quos possimus.
+          Repudiandae cumque delectus ex nihil cum voluptatem? Suscipit deleniti
+          laborum rem repellendus
+          voluptatem soluta inventore odio quaerat, amet, eligendi autem perspiciatis assumenda?
+          </p>
+      </Spoiler>
+      <RangeInput min={2} max={10} />
+      <PasswordConfirm min={2} />
+      <TimerSec sec={3600} />
+      {/* <Timer sec={1800}  /> */}
+      <TimerControl sec={3600} />
+      <TimerContainer seconds={1800} refresh={1000} render={SecondsTimer} />
+      <TimerContainer seconds={1800} refresh={100} render={TimerSec} />
+      {/* <TimerContainer seconds={1800} refresh={100} render='input' /> */}
+      {/* <Timer sec={1800}/> */}
+      {/* <SecondsTimer /> */}
+      {/* <Header children='непарный чилдрен' /> */}
+      {/* <TimerControl hours minutes seconds /> */}
+    </div>
+  );
+}
+
+export default App;

+ 9 - 0
R01_Romanenko/hw1/src/App.test.js

@@ -0,0 +1,9 @@
+import React from 'react';
+import { render } from '@testing-library/react';
+import App from './App';
+
+test('renders learn react link', () => {
+  const { getByText } = render(<App />);
+  const linkElement = getByText(/learn react/i);
+  expect(linkElement).toBeInTheDocument();
+});

+ 13 - 0
R01_Romanenko/hw1/src/index.css

@@ -0,0 +1,13 @@
+body {
+  margin: 0;
+  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
+    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
+    sans-serif;
+  -webkit-font-smoothing: antialiased;
+  -moz-osx-font-smoothing: grayscale;
+}
+
+code {
+  font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
+    monospace;
+}

+ 17 - 0
R01_Romanenko/hw1/src/index.js

@@ -0,0 +1,17 @@
+import React from 'react';
+import ReactDOM from 'react-dom';
+import './index.css';
+import App from './App';
+import * as serviceWorker from './serviceWorker';
+
+ReactDOM.render(
+  <React.StrictMode>
+    <App />
+  </React.StrictMode>,
+  document.getElementById('root')
+);
+
+// If you want your app to work offline and load faster, you can change
+// unregister() to register() below. Note this comes with some pitfalls.
+// Learn more about service workers: https://bit.ly/CRA-PWA
+serviceWorker.unregister();

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 7 - 0
R01_Romanenko/hw1/src/logo.svg


+ 141 - 0
R01_Romanenko/hw1/src/serviceWorker.js

@@ -0,0 +1,141 @@
+// This optional code is used to register a service worker.
+// register() is not called by default.
+
+// This lets the app load faster on subsequent visits in production, and gives
+// it offline capabilities. However, it also means that developers (and users)
+// will only see deployed updates on subsequent visits to a page, after all the
+// existing tabs open on the page have been closed, since previously cached
+// resources are updated in the background.
+
+// To learn more about the benefits of this model and instructions on how to
+// opt-in, read https://bit.ly/CRA-PWA
+
+const isLocalhost = Boolean(
+  window.location.hostname === 'localhost' ||
+    // [::1] is the IPv6 localhost address.
+    window.location.hostname === '[::1]' ||
+    // 127.0.0.0/8 are considered localhost for IPv4.
+    window.location.hostname.match(
+      /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/
+    )
+);
+
+export function register(config) {
+  if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {
+    // The URL constructor is available in all browsers that support SW.
+    const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href);
+    if (publicUrl.origin !== window.location.origin) {
+      // Our service worker won't work if PUBLIC_URL is on a different origin
+      // from what our page is served on. This might happen if a CDN is used to
+      // serve assets; see https://github.com/facebook/create-react-app/issues/2374
+      return;
+    }
+
+    window.addEventListener('load', () => {
+      const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;
+
+      if (isLocalhost) {
+        // This is running on localhost. Let's check if a service worker still exists or not.
+        checkValidServiceWorker(swUrl, config);
+
+        // Add some additional logging to localhost, pointing developers to the
+        // service worker/PWA documentation.
+        navigator.serviceWorker.ready.then(() => {
+          console.log(
+            'This web app is being served cache-first by a service ' +
+              'worker. To learn more, visit https://bit.ly/CRA-PWA'
+          );
+        });
+      } else {
+        // Is not localhost. Just register service worker
+        registerValidSW(swUrl, config);
+      }
+    });
+  }
+}
+
+function registerValidSW(swUrl, config) {
+  navigator.serviceWorker
+    .register(swUrl)
+    .then(registration => {
+      registration.onupdatefound = () => {
+        const installingWorker = registration.installing;
+        if (installingWorker == null) {
+          return;
+        }
+        installingWorker.onstatechange = () => {
+          if (installingWorker.state === 'installed') {
+            if (navigator.serviceWorker.controller) {
+              // At this point, the updated precached content has been fetched,
+              // but the previous service worker will still serve the older
+              // content until all client tabs are closed.
+              console.log(
+                'New content is available and will be used when all ' +
+                  'tabs for this page are closed. See https://bit.ly/CRA-PWA.'
+              );
+
+              // Execute callback
+              if (config && config.onUpdate) {
+                config.onUpdate(registration);
+              }
+            } else {
+              // At this point, everything has been precached.
+              // It's the perfect time to display a
+              // "Content is cached for offline use." message.
+              console.log('Content is cached for offline use.');
+
+              // Execute callback
+              if (config && config.onSuccess) {
+                config.onSuccess(registration);
+              }
+            }
+          }
+        };
+      };
+    })
+    .catch(error => {
+      console.error('Error during service worker registration:', error);
+    });
+}
+
+function checkValidServiceWorker(swUrl, config) {
+  // Check if the service worker can be found. If it can't reload the page.
+  fetch(swUrl, {
+    headers: { 'Service-Worker': 'script' },
+  })
+    .then(response => {
+      // Ensure service worker exists, and that we really are getting a JS file.
+      const contentType = response.headers.get('content-type');
+      if (
+        response.status === 404 ||
+        (contentType != null && contentType.indexOf('javascript') === -1)
+      ) {
+        // No service worker found. Probably a different app. Reload the page.
+        navigator.serviceWorker.ready.then(registration => {
+          registration.unregister().then(() => {
+            window.location.reload();
+          });
+        });
+      } else {
+        // Service worker found. Proceed as normal.
+        registerValidSW(swUrl, config);
+      }
+    })
+    .catch(() => {
+      console.log(
+        'No internet connection found. App is running in offline mode.'
+      );
+    });
+}
+
+export function unregister() {
+  if ('serviceWorker' in navigator) {
+    navigator.serviceWorker.ready
+      .then(registration => {
+        registration.unregister();
+      })
+      .catch(error => {
+        console.error(error.message);
+      });
+  }
+}

+ 5 - 0
R01_Romanenko/hw1/src/setupTests.js

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

+ 340 - 0
R01_Romanenko/lomov/App (7).js

@@ -0,0 +1,340 @@
+import React, { useState, useEffect } from "react";
+// import logo from "./logo.svg";
+import "./App.css";
+
+const Spoiler = ({ header = "+", open, children }) => {
+  const [state, setState] = useState(open);
+  return (
+    <>
+      <div onClick={() => setState(!state)}>{header}</div>
+      {/* <div
+        style={{
+          visibility: state ? "visible" : "hidden",
+        }}
+      > */}
+      {state && children}
+    </>
+    // </div>
+  );
+};
+
+const RangeInput = (props) => {
+  const [text, setText] = useState("RangeInput");
+  return (
+    <div>
+      <label htmlFor="range">RangeInput:</label>
+      <input
+        id="range"
+        type="text"
+        value={text}
+        style={{
+          backgroundColor:
+            text.length < props.min || text.length > props.max ? "#FAA" : "",
+        }}
+        onChange={(e) => setText(e.target.value)}
+      />
+    </div>
+  );
+};
+
+const PasswordConfirm = (props) => {
+  const [password, setPassword] = useState("Password");
+  const [confirmPassword, setConfirnPassword] = useState("PasswordConfirm");
+  return (
+    <div>
+      <label htmlFor="password">Password:</label>
+      <input
+        id="password"
+        type="text"
+        value={password}
+        style={{
+          backgroundColor:
+            password.length < props.min ||
+            password !== confirmPassword ||
+            password.match(/[0-9]+/gi)
+              ? "#FAA"
+              : "",
+        }}
+        onChange={(e) => setPassword(e.target.value)}
+      />
+      <label htmlFor="confirm">ConfirmPassword:</label>
+      <input
+        id="confirm"
+        type="text"
+        value={confirmPassword}
+        style={{
+          backgroundColor:
+            confirmPassword.length < props.min ||
+            confirmPassword !== password ||
+            confirmPassword.match(/[0-9]+/gi)
+              ? "#FAA"
+              : "",
+        }}
+        onChange={(e) => setConfirnPassword(e.target.value)}
+      />
+    </div>
+  );
+};
+
+const LifeCycle = ({ onDelete }) => {
+  const [counter, setCounter] = useState(0);
+  useEffect(() => {
+    let intervalID = setInterval(() => {
+      setCounter((c) => c + 1);
+    }, 1000);
+
+    return () => clearInterval(intervalID);
+    // console.log(intervalID + "intervalID bye-bye")
+  }, []);
+  return (
+    <div>
+      {counter}
+      <button onClick={onDelete}>x</button>
+    </div>
+  );
+};
+
+const LifeStyles = () => {
+  const [count, setCount] = useState(1);
+  return (
+    <>
+      {[..." ".repeat(count)].map(() => (
+        <LifeCycle onDelete={() => setCount(count - 1)} />
+      ))}
+      <button onClick={() => setCount(count + 1)}>+</button>
+    </>
+  );
+};
+
+const Timer = (props) => {
+  const [time, setTime] = useState(props.sec);
+  // console.log("props.sec: ", props.sec);
+  const [pause, setPause] = useState(true);
+
+  let seconds = time % 60;
+  let minutes = Math.floor((time / 60) % 60);
+  let hours = Math.floor(time / 3600);
+
+  let interval;
+
+  useEffect(() => {
+    interval = setInterval(() => {
+      if (!pause) {
+        setTime((time) => time - 1);
+        // console.log("interval: " + interval);
+      }
+    }, props.refresh);
+    return () => clearInterval(interval);
+  }, [pause]);
+
+  return (
+    <div>
+      <span>
+        Timer: {hours}:{minutes}:{Math.trunc(seconds)}
+      </span>
+      <button id="pause" onClick={() => setPause(!pause)}>
+        {/* &#10074;&#10074; */}
+        {pause ? "\u25BA" : "\u275A\u275A"}
+      </button>
+    </div>
+  );
+};
+
+// const MyComponents = {
+//   Timer: (props) => {
+//     const [time, setTime] = useState(props.sec);
+//     const [pause, setPause] = useState(false);
+
+//     const [minute, setMinute] = useState(props.min);
+//     const [hour, setHour] = useState(props.hours);
+
+//     {
+//       if (!pause) {
+//         return (
+//           <div>
+//             <span>
+//               Timer: {hour}:{minute}:{time}
+//             </span>
+//             <button id="pause" onClick={() => setPause(!pause)}>
+//               &#9658;
+//             </button>
+//           </div>
+//         );
+//       }
+//     }
+
+//     {
+//       setTimeout(function () {
+//         if (minute < 0) {
+//           setMinute(59);
+//           setHour(hour - 1);
+//         }
+//         if (time === 0 || time === "00") {
+//           setTime(60);
+//           setMinute(minute - 1);
+//         } else {
+//           setTime(time - 1);
+//         }
+//       }, 1000);
+//     }
+//     return (
+//       <div>
+//         <span>
+//           Timer: {hour}:{minute}:{time}
+//         </span>
+//         <button id="pause" onClick={() => setPause(!pause)}>
+//           &#10074;&#10074;
+//         </button>
+//       </div>
+//     );
+//   },
+// };
+
+const TimerControl = (props) => {
+  const [state, setState] = useState(false);
+
+  const [hours, setHours] = useState(0);
+  const [minutes, setMinutes] = useState(0);
+  const [seconds, setSeconds] = useState(0);
+
+  let sum = +hours * 3600 + +minutes * 60 + +seconds;
+
+  {
+    if (state) {
+      return (
+        <div className="timer-control">
+          <input id="hour" type="text" placeholder="Enter Hours" />
+          <input id="minute" type="text" placeholder="Enter Minutes" />
+          <input id="second" type="text" placeholder="Enter Seconds" />
+          <button onClick={() => setState(!state)}>Start</button>
+          {/* <Timer sec={+seconds} min={+minutes} hours={+hours} /> */}
+          {<Timer sec={sum} refresh={props.refresh} />}
+        </div>
+      );
+    }
+  }
+  return (
+    <div className="timer-control">
+      <input
+        id="hour"
+        type="number"
+        placeholder="Enter Hours"
+        onChange={(e) => setHours(e.target.value)}
+      />
+      <input
+        id="minute"
+        type="number"
+        placeholder="Enter Minutes"
+        onChange={(e) => setMinutes(e.target.value)}
+      />
+      <input
+        id="second"
+        type="number"
+        placeholder="Enter Seconds"
+        onChange={(e) => setSeconds(e.target.value)}
+      />
+      <button onClick={() => setState(!state)}>Start</button>
+    </div>
+  );
+};
+
+const LCD = (props) => {
+  for (let key in props) {
+    console.log("props.key in LCD: " + key);
+  }
+  return (
+    <>
+      <h2>LCD</h2>
+      <div className="digital-clock au-target">
+        <div className="clock-time lcd lcd-frame">
+          {<Timer sec={props.sec} refresh={props.refresh} />}
+          {/* 22<b className="clock-separator-blink">:</b>19
+          <b className="clock-separator-blink">:</b>17 */}
+        </div>
+      </div>
+    </>
+  );
+};
+
+const TimerContainer = ({ seconds, refresh, render: Render }) => {
+  const [text, setText] = useState();
+  const [t0, setT0] = useState(performance.now());
+
+  // const [forget, setForget] = useState();
+
+  // let interval;
+
+  // useEffect(() => {
+  //   interval = setInterval(() => {
+  //     // if (!pause) {
+  //     setForget((forget) => !forget);
+  //     // }
+  //   }, refresh);
+  //   return () => clearInterval(interval);
+  // }, [forget]);
+
+  console.log(text);
+
+  return (
+    <>
+      <h2>TimerContainer</h2>
+      <Render
+        sec={seconds - (performance.now() - t0)}
+        refresh={refresh}
+        value={text}
+        onChange={(e) => {
+          let value = e;
+          if (e && e.target && "value" in e.target) {
+            value = e.target.value;
+          }
+          setText(value);
+        }}
+      />
+    </>
+  );
+};
+
+const SecondsTimer = ({ sec: seconds }) => <h2>{seconds}</h2>;
+
+const App = () => (
+  <div className="App">
+    <Spoiler header={<h1>Заголовок</h1>} open>
+      Контент 1
+      <p>
+        Lorem, ipsum dolor sit amet consectetur adipisicing elit. Nihil ducimus
+        suscipit incidunt officia deleniti, aspernatur unde eius facilis
+        tempora. Eligendi voluptatem deleniti quas dolore rerum! Explicabo
+        obcaecati minus est? Cumque!
+      </p>
+    </Spoiler>
+
+    <Spoiler>
+      <h2>Контент 2</h2>
+      <p>
+        Lorem ipsum dolor sit amet consectetur adipisicing elit. Delectus
+        debitis possimus officiis necessitatibus. Illo quibusdam aliquid
+        temporibus impedit, aliquam dolor harum eius consequuntur laboriosam
+        quam excepturi voluptatibus dolores consequatur sed.
+      </p>
+    </Spoiler>
+    <RangeInput min={2} max={10} />
+    <PasswordConfirm min={2} />
+    <h2>Timer</h2>
+    <TimerControl refresh={100} />
+    <TimerContainer seconds={1800} refresh={100} render={Timer} />
+    <TimerContainer seconds={1800} refresh={100} render={SecondsTimer} />
+    <TimerContainer seconds={1800} refresh={100} render={"input"} />
+    <TimerContainer
+      seconds={1800}
+      refresh={100}
+      render={(props) => <input type="color" {...props} />}
+    />
+    {/* <LifeStyles /> */}
+    {/* <Timer sec={60} min={59} hours={23} /> */}
+    {/* <Timer TimerControl /> */}
+    <TimerContainer seconds={1800} refresh={100} render={LCD} />
+    {/* <LCD /> */}
+  </div>
+);
+
+export default App;

+ 185 - 0
R01_Romanenko/lomov/App.css

@@ -0,0 +1,185 @@
+.App {
+  text-align: center;
+}
+
+.App-logo {
+  height: 40vmin;
+  pointer-events: none;
+}
+
+@media (prefers-reduced-motion: no-preference) {
+  .App-logo {
+    animation: App-logo-spin infinite 20s linear;
+  }
+}
+
+.App div {
+  display: flex;
+}
+
+.App input {
+  margin: 0 10px;
+}
+
+.timer-control {
+  height: 22px;
+  /* display: flex; */
+  /* flex-direction: column; */
+}
+
+#pause {
+  margin-left: 10px;
+  width: 28px;
+  height: 25px;
+  z-index: 2;
+}
+
+.App .login {
+  display: block;
+}
+
+.App div {
+  margin: 20px;
+}
+
+.timer-control div {
+  height: 22px;
+  margin-top: 0;
+}
+
+.login input,
+.login button {
+  margin: 0 10px 10px 5px;
+}
+
+.Aside {
+  width: 30%;
+}
+
+.Main {
+  width: 70%;
+}
+
+.App-header {
+  background-color: #282c34;
+  min-height: 100vh;
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  justify-content: center;
+  font-size: calc(10px + 2vmin);
+  color: white;
+}
+
+.App-link {
+  color: #61dafb;
+}
+
+@keyframes App-logo-spin {
+  from {
+    transform: rotate(0deg);
+  }
+
+  to {
+    transform: rotate(360deg);
+  }
+}
+
+
+/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ LCD ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
+
+@import url(https://fonts.googleapis.com/css?family=VT323:400,600);
+
+.digital-clock {
+  background: #144;
+  padding-left: 5px;
+}
+
+.digital-clock .clock-time {
+  width: 100%;
+  font-size: 6rem;
+  color: greenyellow;
+  font-weight: 600;
+  font-family: VT323, monospace;
+  line-height: 1.2;
+  text-align: center;
+  text-shadow: 0 0 10px #afa;
+}
+
+.lcd-frame {
+  box-shadow: inset 0 0 10px 1px #000;
+}
+
+.lcd-frame div {
+  margin: 0 auto;
+}
+
+.lcd-frame div button {
+  top: 40%;
+  position: absolute;
+  right: 10%;
+}
+
+.lcd {
+  position: relative;
+}
+
+.lcd:after {
+  content: "";
+  position: absolute;
+  top: 0;
+  right: 0;
+  bottom: 0;
+  left: 0;
+  background-image:
+    -webkit-linear-gradient(bottom, rgba(255, 255, 255, 0.2) 33.3%, rgba(255, 255, 255, 0.4) 33.3%, rgba(255, 255, 255, 0.4) 66.7%, rgba(255, 255, 255, 0.6) 66.7%),
+    -webkit-linear-gradient(left, rgba(255, 0, 0, 0.7) 33.3%, rgba(0, 255, 0, 0.7) 33.3%, rgba(0, 255, 0, 0.6) 66.7%, rgba(0, 0, 255, 0.6) 66.7%);
+  background-image:
+    -moz-linear-gradient(bottom, rgba(255, 255, 255, 0.2) 33.3%, rgba(255, 255, 255, 0.4) 33.3%, rgba(255, 255, 255, 0.4) 66.7%, rgba(255, 255, 255, 0.6) 66.7%),
+    -moz-linear-gradient(left, rgba(255, 0, 0, 0.7) 33.3%, rgba(0, 255, 0, 0.7) 33.3%, rgba(0, 255, 0, 0.6) 66.7%, rgba(0, 0, 255, 0.6) 66.7%);
+  background-image:
+    linear-gradient(to top, rgba(255, 255, 255, 0.2) 33.3%, rgba(255, 255, 255, 0.4) 33.3%, rgba(255, 255, 255, 0.4) 66.7%, rgba(255, 255, 255, 0.6) 66.7%),
+    linear-gradient(to right, rgba(255, 0, 0, 0.7) 33.3%, rgba(0, 255, 0, 0.7) 33.3%, rgba(0, 255, 0, 0.6) 66.7%, rgba(0, 0, 255, 0.6) 66.7%);
+  background-size: 4px 4px;
+  mix-blend-mode: multiply;
+}
+
+.digital-clock .clock-separator-blink {
+  position: relative;
+  -moz-animation: clock-separator-blink 1s ease infinite;
+  -webkit-animation: clock-separator-blink 1s ease infinite;
+  animation: clock-separator-blink 1s ease infinite;
+  animation-delay: 2ms;
+  padding-left: 5px;
+  padding-right: 5px;
+}
+
+@-webkit-keyframes clock-separator-blink {
+  0% {
+    opacity: 1.0;
+  }
+
+  100% {
+    opacity: 0;
+  }
+}
+
+@-moz-keyframes clock-separator-blink {
+  0% {
+    opacity: 1.0;
+  }
+
+  100% {
+    opacity: 0;
+  }
+}
+
+@keyframes clock-separator-blink {
+  0% {
+    opacity: 1.0;
+  }
+
+  100% {
+    opacity: 0;
+  }
+}

+ 68 - 0
R01_Romanenko/try.js

@@ -0,0 +1,68 @@
+import React, {useState} from 'react';
+import './App.css';
+
+
+const LoginForm = ({onLogin}) => {
+
+    const [login, setLogin] = useState('admin');
+    const [password, setPassword] = useState('123');
+
+    return (
+        <div>
+            <h1>{login}</h1>
+            <h1>{password}</h1>
+            <div>
+                <label>Username <input type="text" value={login} onChange={(e) => setLogin(e.target.value)}/></label>
+            </div>
+            <div>
+                <label>Password <input type="text" value={password} onChange={(e) => setPassword(e.target.value)}/></label>
+            </div>
+            <button disabled={ login.length <= 1 || password.length <= 1} onClick={()=>onLogin(login, password)}>Send</button>
+        </div>
+    )
+}
+
+
+const Main = () =>
+    <LoginForm onLogin={(l,p) => console.log(l,p)}/>;
+
+export default Main;
+
+
+// Timer &&  TimerControl
+const Timer = ({ sec, min, hrs }) => {
+  // console.log({ sec })
+  const [time, setTime] = useState(sec)
+  const [minute, setMin] = useState(min)
+  const [hours, setHrs] = useState(hrs)
+
+  const [pause, setPause] = useState(false)
+  {
+
+    setTimeout(function () {
+      if (minute < 0) {
+        setMin(minute);
+        setHrs(hours - 1);
+      }
+      if (time === 0 || time === "00") {
+        setTime(time);
+        setMin(minute - 1);
+      } else {
+        setTime(time - 1);
+      }
+    }, 1000);
+
+  }
+  return (
+    <div>
+      <h2>Timer</h2>
+      <span id='timer'>{hours}:{minute}:{time}</span>
+      <button style={{ backgroundColor: pause ? 'green' : '' }}
+        onClick={() => {
+          setPause(!pause);
+          console.log({ pause });
+        }}> &#9208;
+        </button>
+    </div >
+  )
+};

+ 23 - 0
lection40/proect/.gitignore

@@ -0,0 +1,23 @@
+# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
+
+# dependencies
+/node_modules
+/.pnp
+.pnp.js
+
+# testing
+/coverage
+
+# production
+/build
+
+# misc
+.DS_Store
+.env.local
+.env.development.local
+.env.test.local
+.env.production.local
+
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*

+ 68 - 0
lection40/proect/README.md

@@ -0,0 +1,68 @@
+This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
+
+## Available Scripts
+
+In the project directory, you can run:
+
+### `npm start`
+
+Runs the app in the development mode.<br />
+Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
+
+The page will reload if you make edits.<br />
+You will also see any lint errors in the console.
+
+### `npm test`
+
+Launches the test runner in the interactive watch mode.<br />
+See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
+
+### `npm run build`
+
+Builds the app for production to the `build` folder.<br />
+It correctly bundles React in production mode and optimizes the build for the best performance.
+
+The build is minified and the filenames include the hashes.<br />
+Your app is ready to be deployed!
+
+See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
+
+### `npm run eject`
+
+**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
+
+If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
+
+Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
+
+You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
+
+## Learn More
+
+You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
+
+To learn React, check out the [React documentation](https://reactjs.org/).
+
+### Code Splitting
+
+This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting
+
+### Analyzing the Bundle Size
+
+This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size
+
+### Making a Progressive Web App
+
+This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app
+
+### Advanced Configuration
+
+This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration
+
+### Deployment
+
+This section has moved here: https://facebook.github.io/create-react-app/docs/deployment
+
+### `npm run build` fails to minify
+
+This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 13683 - 0
lection40/proect/package-lock.json


+ 34 - 0
lection40/proect/package.json

@@ -0,0 +1,34 @@
+{
+  "name": "proect",
+  "version": "0.1.0",
+  "private": true,
+  "dependencies": {
+    "@testing-library/jest-dom": "^4.2.4",
+    "@testing-library/react": "^9.5.0",
+    "@testing-library/user-event": "^7.2.1",
+    "react": "^16.13.1",
+    "react-dom": "^16.13.1",
+    "react-scripts": "3.4.3"
+  },
+  "scripts": {
+    "start": "react-scripts start",
+    "build": "react-scripts build",
+    "test": "react-scripts test",
+    "eject": "react-scripts eject"
+  },
+  "eslintConfig": {
+    "extends": "react-app"
+  },
+  "browserslist": {
+    "production": [
+      ">0.2%",
+      "not dead",
+      "not op_mini all"
+    ],
+    "development": [
+      "last 1 chrome version",
+      "last 1 firefox version",
+      "last 1 safari version"
+    ]
+  }
+}

BIN
lection40/proect/public/favicon.ico


+ 43 - 0
lection40/proect/public/index.html

@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+<html lang="en">
+  <head>
+    <meta charset="utf-8" />
+    <link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
+    <meta name="viewport" content="width=device-width, initial-scale=1" />
+    <meta name="theme-color" content="#000000" />
+    <meta
+      name="description"
+      content="Web site created using create-react-app"
+    />
+    <link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
+    <!--
+      manifest.json provides metadata used when your web app is installed on a
+      user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
+    -->
+    <link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
+    <!--
+      Notice the use of %PUBLIC_URL% in the tags above.
+      It will be replaced with the URL of the `public` folder during the build.
+      Only files inside the `public` folder can be referenced from the HTML.
+
+      Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
+      work correctly both with client-side routing and a non-root public URL.
+      Learn how to configure a non-root public URL by running `npm run build`.
+    -->
+    <title>React App</title>
+  </head>
+  <body>
+    <noscript>You need to enable JavaScript to run this app.</noscript>
+    <div id="root"></div>
+    <!--
+      This HTML file is a template.
+      If you open it directly in the browser, you will see an empty page.
+
+      You can add webfonts, meta tags, or analytics to this file.
+      The build step will place the bundled scripts into the <body> tag.
+
+      To begin the development, run `npm start` or `yarn start`.
+      To create a production bundle, use `npm run build` or `yarn build`.
+    -->
+  </body>
+</html>

BIN
lection40/proect/public/logo192.png


BIN
lection40/proect/public/logo512.png


+ 25 - 0
lection40/proect/public/manifest.json

@@ -0,0 +1,25 @@
+{
+  "short_name": "React App",
+  "name": "Create React App Sample",
+  "icons": [
+    {
+      "src": "favicon.ico",
+      "sizes": "64x64 32x32 24x24 16x16",
+      "type": "image/x-icon"
+    },
+    {
+      "src": "logo192.png",
+      "type": "image/png",
+      "sizes": "192x192"
+    },
+    {
+      "src": "logo512.png",
+      "type": "image/png",
+      "sizes": "512x512"
+    }
+  ],
+  "start_url": ".",
+  "display": "standalone",
+  "theme_color": "#000000",
+  "background_color": "#ffffff"
+}

+ 3 - 0
lection40/proect/public/robots.txt

@@ -0,0 +1,3 @@
+# https://www.robotstxt.org/robotstxt.html
+User-agent: *
+Disallow:

+ 53 - 0
lection40/proect/src/App (map, key, render prop and so ).js

@@ -0,0 +1,53 @@
+import React, {useState, useEffect} from 'react';
+import logo from './logo.svg';
+import './App.css';
+
+const LifeCycle = ({onDelete}) =>{
+    const [counter, setCounter] = useState(0)
+    useEffect(() => {
+        let intervalID = setInterval(() => {
+            setCounter(c => c +1)
+        },1000)
+        console.log(`${intervalID} start`)
+
+        return () => (clearInterval(intervalID), console.log(`${intervalID} bye-bye`))
+    },[])
+
+    return ( 
+        <div>{counter}</div>
+    )
+}
+
+const LifeStyles = ({render:Render, defaultValue=""}) =>{
+    const [state, setState] = useState({})
+    console.log(state)
+    return (
+        <div>
+        {Object.entries(state).map(([key,value]) => <div key={key}>
+                               <Render value={value} onChange={e => {
+                                   let value = e;
+                                   if (e && e.target && ('value' in e.target)){
+                                       value = e.target.value
+                                   }
+                                   setState({...state, [key]: value})
+                               }} />
+                               <button onClick={() => { 
+                                   let {[key]:___, ...newState} = state
+                                   setState(newState)
+                               }}>x</button>
+                         </div>)}
+        <button onClick={() => setState({...state, [Math.random()]: defaultValue})}>+</button>
+        </div>
+    )
+}
+
+
+
+const App = () =>
+<div className="App">
+    <LifeStyles render={LifeCycle}/>
+    <LifeStyles render={"input"}/>
+    <LifeStyles render={(props) => <input type='color' {...props} />}/>
+</div>
+
+export default App;

+ 38 - 0
lection40/proect/src/App.css

@@ -0,0 +1,38 @@
+.App {
+  text-align: center;
+}
+
+.App-logo {
+  height: 40vmin;
+  pointer-events: none;
+}
+
+@media (prefers-reduced-motion: no-preference) {
+  .App-logo {
+    animation: App-logo-spin infinite 20s linear;
+  }
+}
+
+.App-header {
+  background-color: #282c34;
+  min-height: 100vh;
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  justify-content: center;
+  font-size: calc(10px + 2vmin);
+  color: white;
+}
+
+.App-link {
+  color: #61dafb;
+}
+
+@keyframes App-logo-spin {
+  from {
+    transform: rotate(0deg);
+  }
+  to {
+    transform: rotate(360deg);
+  }
+}

+ 58 - 0
lection40/proect/src/App.js

@@ -0,0 +1,58 @@
+import React, { useState, useEffect } from 'react';
+import logo from './logo.svg';
+import './App.css';
+
+const LifeCycle = ({ onDelete }) => {
+    const [counter, setCounter] = useState(0)
+    useEffect(() => {
+        let intervalID = setInterval(() => {
+            setCounter(c => c + 1)
+        }, 1000)
+        console.log(`${intervalID} start`)
+
+        return () => (clearInterval(intervalID), console.log(`${intervalID} bye-bye`))
+    }, [])
+
+    return (
+        <div>{counter}</div>
+    )
+}
+
+const LifeStyles = ({ render: Render, defaultValue = "" }) => {
+    const [state, setState] = useState({})
+    // const [eye, setEye] = useState(false)
+    console.log(state)
+    return (
+        <div>
+            {Object.entries(state).map(([key, value]) => <div key={key}>
+                <Render value={value} onChange={e => {
+                    let value = e;
+                    if (e && e.target && ('value' in e.target)) {
+                        value = e.target.value
+                        if (typeof value === 'string') {
+                            // console.log(typeof value)
+                            //   console.log(type)  
+                        }
+                    }
+                    setState({ ...state, [key]: value })
+                }} />
+                <button onClick={() => {
+                    let { [key]: ___, ...newState } = state
+                    setState(newState)
+                }}>x</button>
+            </div>)}
+            <button onClick={() => setState({ ...state, [Math.random()]: defaultValue })}>+</button>
+        </div>
+    )
+}
+
+
+
+const App = () =>
+    <div className="App">
+        <LifeStyles render={LifeCycle} />
+        <LifeStyles render={"input"} />
+        <LifeStyles render={(props) => <input type='color' {...props} />} />
+    </div>
+
+export default App;

+ 9 - 0
lection40/proect/src/App.test.js

@@ -0,0 +1,9 @@
+import React from 'react';
+import { render } from '@testing-library/react';
+import App from './App';
+
+test('renders learn react link', () => {
+  const { getByText } = render(<App />);
+  const linkElement = getByText(/learn react/i);
+  expect(linkElement).toBeInTheDocument();
+});

+ 13 - 0
lection40/proect/src/index.css

@@ -0,0 +1,13 @@
+body {
+  margin: 0;
+  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
+    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
+    sans-serif;
+  -webkit-font-smoothing: antialiased;
+  -moz-osx-font-smoothing: grayscale;
+}
+
+code {
+  font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
+    monospace;
+}

+ 17 - 0
lection40/proect/src/index.js

@@ -0,0 +1,17 @@
+import React from 'react';
+import ReactDOM from 'react-dom';
+import './index.css';
+import App from './App';
+import * as serviceWorker from './serviceWorker';
+
+ReactDOM.render(
+  <React.StrictMode>
+    <App />
+  </React.StrictMode>,
+  document.getElementById('root')
+);
+
+// If you want your app to work offline and load faster, you can change
+// unregister() to register() below. Note this comes with some pitfalls.
+// Learn more about service workers: https://bit.ly/CRA-PWA
+serviceWorker.unregister();

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 7 - 0
lection40/proect/src/logo.svg


+ 141 - 0
lection40/proect/src/serviceWorker.js

@@ -0,0 +1,141 @@
+// This optional code is used to register a service worker.
+// register() is not called by default.
+
+// This lets the app load faster on subsequent visits in production, and gives
+// it offline capabilities. However, it also means that developers (and users)
+// will only see deployed updates on subsequent visits to a page, after all the
+// existing tabs open on the page have been closed, since previously cached
+// resources are updated in the background.
+
+// To learn more about the benefits of this model and instructions on how to
+// opt-in, read https://bit.ly/CRA-PWA
+
+const isLocalhost = Boolean(
+  window.location.hostname === 'localhost' ||
+    // [::1] is the IPv6 localhost address.
+    window.location.hostname === '[::1]' ||
+    // 127.0.0.0/8 are considered localhost for IPv4.
+    window.location.hostname.match(
+      /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/
+    )
+);
+
+export function register(config) {
+  if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {
+    // The URL constructor is available in all browsers that support SW.
+    const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href);
+    if (publicUrl.origin !== window.location.origin) {
+      // Our service worker won't work if PUBLIC_URL is on a different origin
+      // from what our page is served on. This might happen if a CDN is used to
+      // serve assets; see https://github.com/facebook/create-react-app/issues/2374
+      return;
+    }
+
+    window.addEventListener('load', () => {
+      const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;
+
+      if (isLocalhost) {
+        // This is running on localhost. Let's check if a service worker still exists or not.
+        checkValidServiceWorker(swUrl, config);
+
+        // Add some additional logging to localhost, pointing developers to the
+        // service worker/PWA documentation.
+        navigator.serviceWorker.ready.then(() => {
+          console.log(
+            'This web app is being served cache-first by a service ' +
+              'worker. To learn more, visit https://bit.ly/CRA-PWA'
+          );
+        });
+      } else {
+        // Is not localhost. Just register service worker
+        registerValidSW(swUrl, config);
+      }
+    });
+  }
+}
+
+function registerValidSW(swUrl, config) {
+  navigator.serviceWorker
+    .register(swUrl)
+    .then(registration => {
+      registration.onupdatefound = () => {
+        const installingWorker = registration.installing;
+        if (installingWorker == null) {
+          return;
+        }
+        installingWorker.onstatechange = () => {
+          if (installingWorker.state === 'installed') {
+            if (navigator.serviceWorker.controller) {
+              // At this point, the updated precached content has been fetched,
+              // but the previous service worker will still serve the older
+              // content until all client tabs are closed.
+              console.log(
+                'New content is available and will be used when all ' +
+                  'tabs for this page are closed. See https://bit.ly/CRA-PWA.'
+              );
+
+              // Execute callback
+              if (config && config.onUpdate) {
+                config.onUpdate(registration);
+              }
+            } else {
+              // At this point, everything has been precached.
+              // It's the perfect time to display a
+              // "Content is cached for offline use." message.
+              console.log('Content is cached for offline use.');
+
+              // Execute callback
+              if (config && config.onSuccess) {
+                config.onSuccess(registration);
+              }
+            }
+          }
+        };
+      };
+    })
+    .catch(error => {
+      console.error('Error during service worker registration:', error);
+    });
+}
+
+function checkValidServiceWorker(swUrl, config) {
+  // Check if the service worker can be found. If it can't reload the page.
+  fetch(swUrl, {
+    headers: { 'Service-Worker': 'script' },
+  })
+    .then(response => {
+      // Ensure service worker exists, and that we really are getting a JS file.
+      const contentType = response.headers.get('content-type');
+      if (
+        response.status === 404 ||
+        (contentType != null && contentType.indexOf('javascript') === -1)
+      ) {
+        // No service worker found. Probably a different app. Reload the page.
+        navigator.serviceWorker.ready.then(registration => {
+          registration.unregister().then(() => {
+            window.location.reload();
+          });
+        });
+      } else {
+        // Service worker found. Proceed as normal.
+        registerValidSW(swUrl, config);
+      }
+    })
+    .catch(() => {
+      console.log(
+        'No internet connection found. App is running in offline mode.'
+      );
+    });
+}
+
+export function unregister() {
+  if ('serviceWorker' in navigator) {
+    navigator.serviceWorker.ready
+      .then(registration => {
+        registration.unregister();
+      })
+      .catch(error => {
+        console.error(error.message);
+      });
+  }
+}

+ 5 - 0
lection40/proect/src/setupTests.js

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

+ 23 - 0
my-project/.gitignore

@@ -0,0 +1,23 @@
+# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
+
+# dependencies
+/node_modules
+/.pnp
+.pnp.js
+
+# testing
+/coverage
+
+# production
+/build
+
+# misc
+.DS_Store
+.env.local
+.env.development.local
+.env.test.local
+.env.production.local
+
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*

+ 68 - 0
my-project/README.md

@@ -0,0 +1,68 @@
+This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
+
+## Available Scripts
+
+In the project directory, you can run:
+
+### `npm start`
+
+Runs the app in the development mode.<br />
+Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
+
+The page will reload if you make edits.<br />
+You will also see any lint errors in the console.
+
+### `npm test`
+
+Launches the test runner in the interactive watch mode.<br />
+See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
+
+### `npm run build`
+
+Builds the app for production to the `build` folder.<br />
+It correctly bundles React in production mode and optimizes the build for the best performance.
+
+The build is minified and the filenames include the hashes.<br />
+Your app is ready to be deployed!
+
+See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
+
+### `npm run eject`
+
+**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
+
+If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
+
+Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
+
+You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
+
+## Learn More
+
+You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
+
+To learn React, check out the [React documentation](https://reactjs.org/).
+
+### Code Splitting
+
+This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting
+
+### Analyzing the Bundle Size
+
+This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size
+
+### Making a Progressive Web App
+
+This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app
+
+### Advanced Configuration
+
+This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration
+
+### Deployment
+
+This section has moved here: https://facebook.github.io/create-react-app/docs/deployment
+
+### `npm run build` fails to minify
+
+This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 14534 - 0
my-project/package-lock.json


+ 36 - 0
my-project/package.json

@@ -0,0 +1,36 @@
+{
+  "name": "my-project",
+  "version": "0.1.0",
+  "private": true,
+  "dependencies": {
+    "@ant-design/icons": "^4.2.2",
+    "@testing-library/jest-dom": "^4.2.4",
+    "@testing-library/react": "^9.5.0",
+    "@testing-library/user-event": "^7.2.1",
+    "antd": "^4.6.3",
+    "react": "^16.13.1",
+    "react-dom": "^16.13.1",
+    "react-scripts": "3.4.3"
+  },
+  "scripts": {
+    "start": "react-scripts start",
+    "build": "react-scripts build",
+    "test": "react-scripts test",
+    "eject": "react-scripts eject"
+  },
+  "eslintConfig": {
+    "extends": "react-app"
+  },
+  "browserslist": {
+    "production": [
+      ">0.2%",
+      "not dead",
+      "not op_mini all"
+    ],
+    "development": [
+      "last 1 chrome version",
+      "last 1 firefox version",
+      "last 1 safari version"
+    ]
+  }
+}

BIN
my-project/public/favicon.ico


+ 43 - 0
my-project/public/index.html

@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+<html lang="en">
+  <head>
+    <meta charset="utf-8" />
+    <link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
+    <meta name="viewport" content="width=device-width, initial-scale=1" />
+    <meta name="theme-color" content="#000000" />
+    <meta
+      name="description"
+      content="Web site created using create-react-app"
+    />
+    <link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
+    <!--
+      manifest.json provides metadata used when your web app is installed on a
+      user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
+    -->
+    <link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
+    <!--
+      Notice the use of %PUBLIC_URL% in the tags above.
+      It will be replaced with the URL of the `public` folder during the build.
+      Only files inside the `public` folder can be referenced from the HTML.
+
+      Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
+      work correctly both with client-side routing and a non-root public URL.
+      Learn how to configure a non-root public URL by running `npm run build`.
+    -->
+    <title>React App</title>
+  </head>
+  <body>
+    <noscript>You need to enable JavaScript to run this app.</noscript>
+    <div id="root"></div>
+    <!--
+      This HTML file is a template.
+      If you open it directly in the browser, you will see an empty page.
+
+      You can add webfonts, meta tags, or analytics to this file.
+      The build step will place the bundled scripts into the <body> tag.
+
+      To begin the development, run `npm start` or `yarn start`.
+      To create a production bundle, use `npm run build` or `yarn build`.
+    -->
+  </body>
+</html>

BIN
my-project/public/logo192.png


BIN
my-project/public/logo512.png


+ 25 - 0
my-project/public/manifest.json

@@ -0,0 +1,25 @@
+{
+  "short_name": "React App",
+  "name": "Create React App Sample",
+  "icons": [
+    {
+      "src": "favicon.ico",
+      "sizes": "64x64 32x32 24x24 16x16",
+      "type": "image/x-icon"
+    },
+    {
+      "src": "logo192.png",
+      "type": "image/png",
+      "sizes": "192x192"
+    },
+    {
+      "src": "logo512.png",
+      "type": "image/png",
+      "sizes": "512x512"
+    }
+  ],
+  "start_url": ".",
+  "display": "standalone",
+  "theme_color": "#000000",
+  "background_color": "#ffffff"
+}

+ 3 - 0
my-project/public/robots.txt

@@ -0,0 +1,3 @@
+# https://www.robotstxt.org/robotstxt.html
+User-agent: *
+Disallow:

+ 13 - 0
my-project/src/App.js

@@ -0,0 +1,13 @@
+import React from "react";
+import RegisterForm from "./components/RegisterForm";
+import "./styles/App.css";
+
+function App() {
+  return (
+    <div className="App">
+      <RegisterForm />
+    </div>
+  );
+}
+
+export default App;

+ 74 - 0
my-project/src/components/RegisterForm.js

@@ -0,0 +1,74 @@
+import React from "react";
+import { Form, Input, Button, Checkbox } from "antd";
+import { UserOutlined, LockOutlined } from "@ant-design/icons";
+
+import "../styles/RegisterForm.css";
+
+export default () => {
+  const [form] = Form.useForm();
+
+  const onFinish = (values) => {
+    console.log("Success:", values);
+  };
+
+  const onFinishFailed = (errorInfo) => {
+    console.log("Failed:", errorInfo);
+  };
+
+  return (
+    <div className="registerForm">
+      <Form
+        name="basic"
+        form={form}
+        initialValues={{
+          remember: true,
+        }}
+        onFinish={onFinish}
+        onFinishFailed={onFinishFailed}
+      >
+        <Form.Item
+          label="Username"
+          name="username"
+          rules={[
+            {
+              required: true,
+              message: "Please input your username!",
+            },
+          ]}
+        >
+          <Input
+            prefix={<UserOutlined className="site-form-item-icon" />}
+            onChange={(e) => {
+                console.log(e.target.value)
+                form.setFieldsValue({ username: e.target.value })}}
+          />
+        </Form.Item>
+
+        <Form.Item
+          label="Password"
+          name="password"
+          rules={[
+            {
+              required: true,
+              message: "Please input your password!",
+            },
+          ]}
+        >
+          <Input.Password
+            prefix={<LockOutlined className="site-form-item-icon" />}
+          />
+        </Form.Item>
+
+        <Form.Item name="remember" valuePropName="checked">
+          <Checkbox>Remember me</Checkbox>
+        </Form.Item>
+
+        <Form.Item>
+          <Button type="primary" htmlType="submit">
+            Submit
+          </Button>
+        </Form.Item>
+      </Form>
+    </div>
+  );
+};

+ 13 - 0
my-project/src/index.css

@@ -0,0 +1,13 @@
+body {
+  margin: 0;
+  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
+    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
+    sans-serif;
+  -webkit-font-smoothing: antialiased;
+  -moz-osx-font-smoothing: grayscale;
+}
+
+code {
+  font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
+    monospace;
+}

+ 17 - 0
my-project/src/index.js

@@ -0,0 +1,17 @@
+import React from 'react';
+import ReactDOM from 'react-dom';
+import './index.css';
+import App from './App';
+import * as serviceWorker from './serviceWorker';
+
+ReactDOM.render(
+  <React.StrictMode>
+    <App />
+  </React.StrictMode>,
+  document.getElementById('root')
+);
+
+// If you want your app to work offline and load faster, you can change
+// unregister() to register() below. Note this comes with some pitfalls.
+// Learn more about service workers: https://bit.ly/CRA-PWA
+serviceWorker.unregister();

+ 141 - 0
my-project/src/serviceWorker.js

@@ -0,0 +1,141 @@
+// This optional code is used to register a service worker.
+// register() is not called by default.
+
+// This lets the app load faster on subsequent visits in production, and gives
+// it offline capabilities. However, it also means that developers (and users)
+// will only see deployed updates on subsequent visits to a page, after all the
+// existing tabs open on the page have been closed, since previously cached
+// resources are updated in the background.
+
+// To learn more about the benefits of this model and instructions on how to
+// opt-in, read https://bit.ly/CRA-PWA
+
+const isLocalhost = Boolean(
+  window.location.hostname === 'localhost' ||
+    // [::1] is the IPv6 localhost address.
+    window.location.hostname === '[::1]' ||
+    // 127.0.0.0/8 are considered localhost for IPv4.
+    window.location.hostname.match(
+      /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/
+    )
+);
+
+export function register(config) {
+  if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {
+    // The URL constructor is available in all browsers that support SW.
+    const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href);
+    if (publicUrl.origin !== window.location.origin) {
+      // Our service worker won't work if PUBLIC_URL is on a different origin
+      // from what our page is served on. This might happen if a CDN is used to
+      // serve assets; see https://github.com/facebook/create-react-app/issues/2374
+      return;
+    }
+
+    window.addEventListener('load', () => {
+      const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;
+
+      if (isLocalhost) {
+        // This is running on localhost. Let's check if a service worker still exists or not.
+        checkValidServiceWorker(swUrl, config);
+
+        // Add some additional logging to localhost, pointing developers to the
+        // service worker/PWA documentation.
+        navigator.serviceWorker.ready.then(() => {
+          console.log(
+            'This web app is being served cache-first by a service ' +
+              'worker. To learn more, visit https://bit.ly/CRA-PWA'
+          );
+        });
+      } else {
+        // Is not localhost. Just register service worker
+        registerValidSW(swUrl, config);
+      }
+    });
+  }
+}
+
+function registerValidSW(swUrl, config) {
+  navigator.serviceWorker
+    .register(swUrl)
+    .then(registration => {
+      registration.onupdatefound = () => {
+        const installingWorker = registration.installing;
+        if (installingWorker == null) {
+          return;
+        }
+        installingWorker.onstatechange = () => {
+          if (installingWorker.state === 'installed') {
+            if (navigator.serviceWorker.controller) {
+              // At this point, the updated precached content has been fetched,
+              // but the previous service worker will still serve the older
+              // content until all client tabs are closed.
+              console.log(
+                'New content is available and will be used when all ' +
+                  'tabs for this page are closed. See https://bit.ly/CRA-PWA.'
+              );
+
+              // Execute callback
+              if (config && config.onUpdate) {
+                config.onUpdate(registration);
+              }
+            } else {
+              // At this point, everything has been precached.
+              // It's the perfect time to display a
+              // "Content is cached for offline use." message.
+              console.log('Content is cached for offline use.');
+
+              // Execute callback
+              if (config && config.onSuccess) {
+                config.onSuccess(registration);
+              }
+            }
+          }
+        };
+      };
+    })
+    .catch(error => {
+      console.error('Error during service worker registration:', error);
+    });
+}
+
+function checkValidServiceWorker(swUrl, config) {
+  // Check if the service worker can be found. If it can't reload the page.
+  fetch(swUrl, {
+    headers: { 'Service-Worker': 'script' },
+  })
+    .then(response => {
+      // Ensure service worker exists, and that we really are getting a JS file.
+      const contentType = response.headers.get('content-type');
+      if (
+        response.status === 404 ||
+        (contentType != null && contentType.indexOf('javascript') === -1)
+      ) {
+        // No service worker found. Probably a different app. Reload the page.
+        navigator.serviceWorker.ready.then(registration => {
+          registration.unregister().then(() => {
+            window.location.reload();
+          });
+        });
+      } else {
+        // Service worker found. Proceed as normal.
+        registerValidSW(swUrl, config);
+      }
+    })
+    .catch(() => {
+      console.log(
+        'No internet connection found. App is running in offline mode.'
+      );
+    });
+}
+
+export function unregister() {
+  if ('serviceWorker' in navigator) {
+    navigator.serviceWorker.ready
+      .then(registration => {
+        registration.unregister();
+      })
+      .catch(error => {
+        console.error(error.message);
+      });
+  }
+}

+ 8 - 0
my-project/src/styles/App.css

@@ -0,0 +1,8 @@
+@import '~antd/dist/antd.css';
+
+.App {
+    height: 100%;
+    display: flex;
+    align-items: center;
+    justify-content: center;
+}

+ 5 - 0
my-project/src/styles/RegisterForm.css

@@ -0,0 +1,5 @@
+.registerForm {
+    padding: 24px;
+    border-radius: 5px;
+    border: 2px solid #666666;
+}