Анатолий Пивоварский 1 year ago
parent
commit
75b4554d9f

+ 57 - 0
HW 7/script.js

@@ -0,0 +1,57 @@
+var persons = [
+    {name: "Иван", age: 17},
+    {name: "Мария", age: 35},
+    {name: "Алексей", age: 73},
+    {name: "Яков", age: 12},
+]
+persons.sort((a,b) => a.age > b.age ? 1 : -1);
+sort(persons, "age");
+//
+persons.sort((a,b) => a.name > b.name ? 1 : -1);
+sort(persons, "name", false);
+
+//array map
+
+let arr = ["1", {}, null, undefined, "500", 700];
+let result = arr.map(function(item){
+    let number = parseInt(item);
+    return isNaN(number) ?  item : number;
+});
+
+console.log(result);
+
+//array reduce
+
+let arr2 = ["0", 5, 3, "string", null];
+let arr3 = arr2.filter(item => typeof item === 'number');
+arr3.reduce((a, b) => a * b);
+
+console.log(number02)
+
+//object filter
+
+var phone = {
+    brand: "meizu",
+    model: "m2",
+    ram: 2,
+    color: "black",
+};
+function filter (a, b){
+   let phone = {}
+   for (let key in a){
+    if (b (key, a[key])) {
+        phone [key] = a[key];
+    }
+   }
+   return phone
+  }
+
+console.log(filter(phone,(key,value) => key == "color" || value == 2));
+
+//object map
+
+map({name: "Иван", age: 17},function(key,value){
+    var result = {};
+    result[key+"_"] = value + "$";
+    return result;
+})

BIN
react/public/favicon.ico


+ 43 - 0
react/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
react/public/logo192.png


BIN
react/public/logo512.png


+ 25 - 0
react/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
react/public/robots.txt

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

+ 30 - 0
react/src/App.css

@@ -0,0 +1,30 @@
+
+.App-logo {
+  height: 10vmin;
+  pointer-events: none;
+}
+
+@media (prefers-reduced-motion: no-preference) {
+  .App-logo {
+    animation: App-logo-spin infinite 20s linear;
+  }
+}
+
+.App-header {
+  background-color: #282c34;
+  font-size: calc(10px + 2vmin);
+  color: white;
+}
+
+.App-link {
+  color: #61dafb;
+}
+
+@keyframes App-logo-spin {
+  from {
+    transform: rotate(0deg);
+  }
+  to {
+    transform: rotate(360deg);
+  }
+}

+ 222 - 0
react/src/App.js

@@ -0,0 +1,222 @@
+import logo from './logo.svg';
+import './App.css';
+
+const Header = () =>(
+  <header class="header">
+    <div class="container">
+      <div class="header-wrap">
+        <a href="#" class="logo">
+          <img src="img\WD.png" alt="WD-logo" />
+        </a>
+        <nav class="nav">
+          <input type="checkbox" id="burger" class="hidden" />
+          <label for="burger" class="burger">
+            <span></span>
+          </label>
+          <ul class="nav-list">
+            <li class="nav-item">
+              <a href="index.html" class="nav-link">ГЛАВНАЯ</a></li>
+            <li class="nav-item">
+              <a href="#" class="nav-link"> ОБ АВТОРЕ</a></li>
+            <li class="nav-item">
+              <a href="#" class="nav-link"> РАБОТЫ</a></li>
+            <li class="nav-item">
+              <a href="#" class="nav-link"> ПРОЦЕСС</a></li>
+            <li class="nav-item"> <a href="#" class="nav-link">КОНТАКТЫ</a>
+            </li>
+          </ul>
+        </nav>
+      </div>
+      <div class="header-info">
+        <img class="image-info" src="/img/Frame.png" alt="Frame-img" />
+        <div class="info-item">
+          <h1>Дизайн и верстка</h1>
+          <p>
+            Lorem Ipsum - это текст-"рыба", часто используемый в печати и
+            вэб-дизайне. Lorem Ipsum является стандартной "рыбой" для текстов на
+            латинице с начала XVI века.
+          </p>
+          <div class="info-bottom">
+            <a href="#" class="btn-head">НАПИСАТЬ МНЕ
+            </a>
+          </div>
+        </div>
+      </div>
+    </div>
+  </header>
+);
+
+const Main = () => 
+(
+  <main>
+    <section class="about">
+      <div class="container">
+        <h2>Обо мне</h2>
+        <p>
+          Lorem Ipsum - это текст-"рыба", часто используемый в печати и
+          вэб-дизайне. Lorem Ipsum является стандартной "рыбой" для текстов на
+          латинице с начала XVI века.
+        </p>
+      </div>
+    </section>
+    <section class="about-item">
+      <div class="container img-item">
+        <img class="numbers-item" src="/img/Project.png" alt="about-item" />
+        <img class="numbers-item" src="/img/Project.png" alt="about-item" />
+        <img class="numbers-item" src="/img/Project.png" alt="about-item" />
+        <img class="numbers-item" src="/img/Project.png" alt="about-item" />
+        <img class="numbers-item" src="/img/Project.png" alt="about-item" />
+        <img class="numbers-item" src="/img/Project.png" alt="about-item" />
+      </div>
+    </section>
+    <section className="skill">
+      <div className="container">
+        <div className="row">
+          <div className="col col-description">
+            <header className="skill-header">
+              <h2>Мои навыки</h2>
+            </header>
+            <div className="skill-box">
+              <div className="skill-item">
+                <span class="skill-label">Adobe Photoshop</span>
+                <div className="skill-loader">
+                  <div className="skill-load"></div>
+                </div>
+              </div>
+              <div className="skill-item">
+                <span class="skill-label">Adobe Photoshop</span>
+                <div className="skill-loader">
+                  <div className="skill-load"></div>
+                </div>
+              </div>
+              <div className="skill-item">
+                <span class="skill-label">Adobe Photoshop</span>
+                <div className="skill-loader">
+                  <div className="skill-load"></div>
+                </div>
+              </div>
+              <div class="col col-img">
+                <img
+                  src="/img/Man.png"
+                  alt="image-description "
+                  className="img-man"
+                />
+              </div>
+            </div>
+          </div>
+        </div>
+      </div>
+    </section>
+    <section class="media">
+      <div class="container">
+        <h3>Как я работаю</h3>
+        <p>
+          Lorem Ipsum - это текст-"рыба", часто используемый в печати и
+          вэб-дизайне. Lorem Ipsum является стандартной "рыбой" для текстов на
+          латинице с начала XVI века.
+        </p>
+        <div class="media-img">
+          <img src="/img/Code.png" width="1110" height="600" alt="media-img" />
+          <img
+            class="play-button"
+            src="/img/play-button.png"
+            alt="play-button"
+          />
+        </div>
+      </div>
+    </section>
+
+    <section className="gallery">
+      <div className="gallery-row">
+        <a href="#" className="gallery-cols"></a>
+        <a href="#" className="gallery-colf"></a>
+        <a href="#" className="gallery-cols"></a>
+        <a href="#" className="gallery-colf"></a>
+        <a href="#" className="gallery-cols"></a>
+        <a href="#" className="gallery-colf"></a>
+        <a href="#" className="gallery-cols"></a>
+        <a href="#" className="gallery-colf"></a>
+      </div>
+    </section>
+    <section>
+      <div class="microsoft">
+        <img
+          class="microsoft logo_1"
+          src="/img/Microsoft.png"
+          alt="microsoft-logo"
+        />
+        <img
+          class="microsoft logo_2"
+          src="/img/Microsoft.png"
+          alt="microsoft-logo"
+        />
+        <img
+          class="microsoft logo_3"
+          src="/img/Microsoft.png"
+          alt="microsoft-logo"
+        />
+        <img
+          class="microsoft logo_4"
+          src="/img/Microsoft.png"
+          alt="microsoft-logo"
+        />
+      </div>
+    </section>
+  </main>
+);
+const Footer = () =>
+(
+  <footer class="footer">
+    <div class="container">
+      <div class="footer-list">
+        <h4>Хотите веб-сайт?</h4>
+        <p>
+          Lorem Ipsum - это текст-"рыба", часто используемый в печати и
+          вэб-дизайне. Lorem Ipsum является стандартной "рыбой" для текстов на
+          латинице с начала XVI века.
+        </p>
+
+        <form class="footer-form" action="#" method="post" name="info-client ">
+          <input class="form-name" type="text" placeholder="Ваше имя" />
+          <input class="form-mail" type="text" placeholder="Ваш e-mail" />
+          <input class="form-textarea" type="text" placeholder="Cообщение" />
+
+          <button class="btn-form" type="submit" form="form" value="Submit">
+            Отправить
+          </button>
+        </form>
+      </div>
+    </div>
+    <section class="bottom-section">
+      <div class="container">
+        <div class="bottom-area">
+          <div class="contact">
+            <p>Иванов Иван</p>
+            <span>(с) 2018. Все права защищены.</span>
+          </div>
+          <div class="logo-bottom">
+            <a href="#">
+              <img src="/img/Vk.png" alt="vk-logo" />
+            </a>
+            <a href="#">
+              <img src="/img/Vk.png" alt="vk-logo" />
+            </a>
+            <a href="#">
+              <img src="/img/Vk.png" alt="vk-logo" />
+            </a>
+          </div>
+        </div>
+      </div>
+    </section>
+  </footer>
+);
+
+const App = ()  =>
+    <div className="wrapper">
+      <Header/>
+      <Main/>
+      <Footer/>
+    </div>
+
+
+export default App;

+ 8 - 0
react/src/App.test.js

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

+ 13 - 0
react/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
react/src/index.js

@@ -0,0 +1,17 @@
+import React from 'react';
+import ReactDOM from 'react-dom/client';
+import './index.css';
+import App from './App';
+import reportWebVitals from './reportWebVitals';
+
+const root = ReactDOM.createRoot(document.getElementById('root'));
+root.render(
+  <React.StrictMode>
+    <App />
+  </React.StrictMode>
+);
+
+// If you want to start measuring performance in your app, pass a function
+// to log results (for example: reportWebVitals(console.log))
+// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
+reportWebVitals();

File diff suppressed because it is too large
+ 1 - 0
react/src/logo.svg


+ 13 - 0
react/src/reportWebVitals.js

@@ -0,0 +1,13 @@
+const reportWebVitals = onPerfEntry => {
+  if (onPerfEntry && onPerfEntry instanceof Function) {
+    import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
+      getCLS(onPerfEntry);
+      getFID(onPerfEntry);
+      getFCP(onPerfEntry);
+      getLCP(onPerfEntry);
+      getTTFB(onPerfEntry);
+    });
+  }
+};
+
+export default reportWebVitals;

+ 5 - 0
react/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';