Browse Source

add first screen on react

serg155alternate 2 years ago
parent
commit
479b5eef9c
9 changed files with 271 additions and 78 deletions
  1. BIN
      public/favicon.ico
  2. BIN
      public/logo.png
  3. BIN
      public/main_image.png
  4. 108 29
      src/App.css
  5. 70 19
      src/App.js
  6. 76 8
      src/App.test.js
  7. 17 9
      src/index.js
  8. BIN
      src/main_image.png
  9. 0 13
      src/reportWebVitals.js

BIN
public/favicon.ico


BIN
public/logo.png


BIN
public/main_image.png


+ 108 - 29
src/App.css

@@ -1,38 +1,117 @@
-.App {
-  text-align: center;
+html {
+  box-sizing: border-box;
+  font-family: 'Lato', sans-serif;
 }
-
-.App-logo {
-  height: 40vmin;
-  pointer-events: none;
+*,
+:before,
+:after {
+  box-sizing: inherit;
 }
-
-@media (prefers-reduced-motion: no-preference) {
-  .App-logo {
-    animation: App-logo-spin infinite 20s linear;
-  }
+.container {
+  max-width: 1150px;
+  margin: 0 auto;
+}
+.btn {
+  margin: 0 auto;
+  border: solid 3px #fff;
+}
+.btn_header {
+      width: 280px;
+      height: 68px;
+      padding: 25px 0 30px 0;
+      margin-bottom: 41px;
+}
+.btn_header a {
+          text-decoration: none;
+          font-family: Lato;
+          font-size: 18px;
+          font-weight: bold;
+          font-stretch: normal;
+          font-style: normal;
+          line-height: 1.17;
+          letter-spacing: 0.45px;
+          text-align: center;
+          color: #fff;
 }
 
-.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;
+.btn_log {
+      width: 80%;
+      height: 50px;
+      background-color:rgb(119, 22, 78); 
+      border:none;
+      color: #fff;
 }
 
-.App-link {
-  color: #61dafb;
+.header { 
+  min-height: 880px;
+  width: 100%;
+  padding: 31px 0 240px 0 ;
+  background: url(main_image.png) no-repeat 100% / cover; 
+}
+.header__top {
+      display: flex;
+      justify-content: space-between;
+      align-items:center;
+      margin-bottom: 292px;
+}
+.header__nav ul{
+      display: flex;
+      justify-content: space-between;
+      list-style: none;
+}
+.header__nav li{
+          padding-right: 30px;
+          text-transform: uppercase;
 }
 
-@keyframes App-logo-spin {
-  from {
-    transform: rotate(0deg);
-  }
-  to {
-    transform: rotate(360deg);
-  }
+.header__link a {
+      text-decoration: none;
+      text-shadow: -0.9px 0.5px 40px rgba(1, 1, 1, 0.55);
+      font-family: Lato;
+      font-size: 14px;
+      font-stretch: normal;
+      font-style: normal;
+      line-height: 2.14;
+      letter-spacing: 0.7px;
+      text-align: left;
+      color: #fff;
+}
+.header__nav{
+      display: flex;
+      justify-content: space-evenly;
+      align-items:center;
+}
+.header__content {
+      text-align: center;
+}
+.header__content h1 {
+          text-shadow: -0.9px 0.5px 40px rgba(1, 1, 1, 0.55);
+          font-family: Lato;
+          font-size: 100px;
+          font-weight: bold;
+          font-stretch: normal;
+          font-style: normal;
+          letter-spacing: 5px;
+          color: #fff;
+          margin-bottom: 41px;
+}
+.header__content h2 {
+          text-shadow: -0.9px 0.5px 40px rgba(1, 1, 1, 0.55);
+          font-family: TimesNewRomanPS-MT;
+          font-size: 36px;
+          font-weight: bold;
+          font-stretch: normal;
+          font-style: italic;
+          letter-spacing: 1.8px;
+          color: rgba(255, 255, 255, 0.7);
+}
+.header__content h4 {
+          text-shadow: -0.9px 0.5px 40px rgba(1, 1, 1, 0.55);
+          font-family: Lato;
+          font-weight: normal;
+          font-stretch: normal;
+          font-style: normal;
+          letter-spacing: 0.7px;
+          color: #fff;
+          text-transform: uppercase;
 }

+ 70 - 19
src/App.js

@@ -1,25 +1,76 @@
-import logo from './logo.svg';
+//import React from 'react'; or 
+import {Component, StrictMode} from 'react';  //  destruct sintax
 import './App.css';
 
+//using another sintax class
+
+
+class Nav extends Component {
+    render() {
+        return  <nav class="header__nav"> 
+                    <ul>
+                        <li class="header__link login"><a href="#">LOG IN</a></li>
+                        <li class="header__link sign"><a href="#">SIGN UP</a></li>
+                    </ul> 
+                    <div class="hamburger">
+                        <span></span>
+                        <span></span>
+                        <span></span>
+                    </div>   
+                </nav> 
+        }   
+}
+
+//another sintx function 
+
+function Btn() {
+
+    const text = 'Log in';
+    const logged = true; //conditions
+
+    return <div class="btn btn_header">
+                <a href="#"> {logged?'GET STARTED': text}</a>
+           </div>
+}
+
+
+
+//another sintax const 
+let h2Text = 'Find your Favorite',
+    h1Text = 'RECIPES',
+    h4Text = 'OR SEND US YOUR OWN RECIPES AND GET REWARDED!';
+
+let Logo = () => <a href="#"><img src="logo.png" alt="Food"/></a>;
+
+
+
+
+const Header = () => {
+    return <header class="header">
+              <div class="container">
+                  <div class="header__top">
+                      <Logo/>
+                      <Nav/>
+                  </div>
+                  <div class="header__content">
+                      <h2>{h2Text}</h2>
+                      <h1>{h1Text}</h1>
+                      <Btn/>
+                      <h4>{h4Text}</h4>
+                  </div>
+              </div>
+          </header>
+}
+
 function App() {
-  return (
-    <div className="App">
-      <header className="App-header">
-        <img src={logo} className="App-logo" alt="logo" />
-        <p>
-          Edit <code>src/App.js</code> and save to reload.
-        </p>
-        <a
-          className="App-link"
-          href="https://reactjs.org"
-          target="_blank"
-          rel="noopener noreferrer"
-        >
-          Learn React
-        </a>
-      </header>
-    </div>
-  );
+    return (
+      <div>
+          <StrictMode>
+              <Header/>
+          </StrictMode>
+      </div>
+    );
 }
 
 export default App;
+

+ 76 - 8
src/App.test.js

@@ -1,8 +1,76 @@
-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();
-});
+//import React from 'react'; or 
+import {Component, StrictMode} from 'react';  //  destruct sintax
+import './App.css';
+
+//using another sintax class
+
+
+class Nav extends Component {
+    render() {
+        return  <nav class="header__nav"> 
+                    <ul>
+                        <li class="header__link login"><a href="#">LOG IN</a></li>
+                        <li class="header__link sign"><a href="#">SIGN UP</a></li>
+                    </ul> 
+                    <div class="hamburger">
+                        <span></span>
+                        <span></span>
+                        <span></span>
+                    </div>   
+                </nav> 
+        }   
+}
+
+//another sintx function 
+
+function Btn() {
+
+    const text = 'Log in';
+    const logged = true; //conditions
+
+    return <div class="btn btn_header">
+                <a href="#"> {logged?'GET STARTED': text}</a>
+           </div>
+}
+
+
+
+//another sintax const 
+let h2Text = 'Find your Favorite',
+    h1Text = 'RECIPES',
+    h4Text = 'OR SEND US YOUR OWN RECIPES AND GET REWARDED!';
+
+let Logo = () => <a href="#"><img src="logo.png" alt="Food"/></a>;
+
+
+
+
+const Header = () => {
+    return <header class="header">
+              <div class="container">
+                  <div class="header__top">
+                      <Logo/>
+                      <Nav/>
+                  </div>
+                  <div class="header__content">
+                      <h2>{h2Text}</h2>
+                      <h1>{h1Text}</h1>
+                      <Btn/>
+                      <h4>{h4Text}</h4>
+                  </div>
+              </div>
+          </header>
+}
+
+function App() {
+    return (
+      <div>
+          <StrictMode>
+              <Header/>
+          </StrictMode>
+      </div>
+    );
+}
+
+export default App;
+

+ 17 - 9
src/index.js

@@ -1,17 +1,25 @@
-import React from 'react';
+import React, {StrictMode} from 'react';
 import ReactDOM from 'react-dom';
 import './index.css';
 import App from './App';
-import reportWebVitals from './reportWebVitals';
+
+//const elem = React.createElement('h2', {className: 'App-header'}, 'Hello world'); 
+
+/* const text = 'Hello world';
+const elem = (
+  <div className="App">
+    <h1 className={text}>This is the text:{text}</h1>
+    <input type="text" />
+    <button tabIndex='0' >push me</button>
+  </div>
+  
+) */
 
 ReactDOM.render(
-  <React.StrictMode>
-    <App />
-  </React.StrictMode>,
+  <StrictMode>
+      <App/>
+  </StrictMode>,
   document.getElementById('root')
 );
 
-// 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();
+

BIN
src/main_image.png


+ 0 - 13
src/reportWebVitals.js

@@ -1,13 +0,0 @@
-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;