feat(header-top): Adiciona Header-top desktop e mobile

This commit is contained in:
Manuela Luana Schumacker Tavares 2023-01-04 15:23:09 -03:00
parent 0c351a3524
commit 191365bb37
17 changed files with 29209 additions and 0 deletions

23
desafio-react-app/.gitignore vendored Normal file
View File

@ -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*

View File

@ -0,0 +1,46 @@
# Getting Started with Create React App
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.\
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
The page will reload if you make edits.\
You will also see any lint errors in the console.
### `npm test`
Launches the test runner in the interactive watch mode.\
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.\
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.\
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 cant go back!**
If you arent 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 youre on your own.
You dont have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldnt feel obligated to use this feature. However we understand that this tool wouldnt be useful if you couldnt 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/).

28759
desafio-react-app/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,46 @@
{
"name": "desafio-react-app",
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"@types/jest": "^27.5.2",
"@types/node": "^16.18.11",
"@types/react": "^18.0.26",
"@types/react-dom": "^18.0.10",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-scripts": "5.0.1",
"typescript": "^4.9.4",
"web-vitals": "^2.1.4"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"sass": "^1.57.1"
}
}

View File

@ -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>

View File

@ -0,0 +1,12 @@
<svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_3758_87)">
<path d="M27.823 4.07236C27.6697 3.88079 27.4377 3.76928 27.1923 3.76928H5.69581L5.09469 1.16451C5.01009 0.798054 4.68377 0.538452 4.30768 0.538452H0.80768C0.361648 0.538452 0 0.9001 0 1.34619C0 1.79227 0.361648 2.15387 0.80768 2.15387H3.66516L7.7455 19.8355C7.83005 20.2019 8.15642 20.4615 8.53251 20.4615H24.7154C25.1614 20.4615 25.523 20.0999 25.523 19.6539C25.523 19.2078 25.1614 18.8462 24.7154 18.8462H9.17509L8.55384 16.1539H24.7693C25.1471 16.1539 25.4744 15.892 25.5573 15.5235L27.9803 4.75426C28.0342 4.51483 27.9763 4.26398 27.823 4.07236Z" fill="white"/>
<path d="M11.8461 21.5385C10.2131 21.5385 8.88452 22.867 8.88452 24.5C8.88452 26.133 10.213 27.4615 11.8461 27.4615C13.479 27.4615 14.8076 26.133 14.8076 24.5C14.8076 22.867 13.4791 21.5385 11.8461 21.5385Z" fill="white"/>
<path d="M21.5385 21.5385C19.9055 21.5385 18.5769 22.867 18.5769 24.5C18.5769 26.133 19.9054 27.4615 21.5385 27.4615C23.1714 27.4615 24.5 26.133 24.5 24.5C24.5 22.867 23.1715 21.5385 21.5385 21.5385Z" fill="white"/>
</g>
<defs>
<clipPath id="clip0_3758_87">
<rect width="28" height="28" fill="white"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -0,0 +1,3 @@
<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M13.2094 11.6186C14.0951 10.409 14.6249 8.92328 14.6249 7.31261C14.6249 3.28064 11.3444 0.00012207 7.31245 0.00012207C3.28048 0.00012207 0 3.28064 0 7.31261C0 11.3446 3.28052 14.6251 7.31248 14.6251C8.92315 14.6251 10.409 14.0952 11.6186 13.2094L16.4092 18L18 16.4092C18 16.4092 13.2094 11.6186 13.2094 11.6186ZM7.31248 12.3751C4.52086 12.3751 2.25001 10.1042 2.25001 7.31261C2.25001 4.52098 4.52086 2.25013 7.31248 2.25013C10.1041 2.25013 12.375 4.52098 12.375 7.31261C12.375 10.1042 10.1041 12.3751 7.31248 12.3751Z" fill="#303030"/>
</svg>

After

Width:  |  Height:  |  Size: 648 B

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 19 KiB

View File

@ -0,0 +1,5 @@
<svg width="28" height="23" viewBox="0 0 28 23" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M26.25 19.0001H1.75002C0.783509 19.0001 0 19.7836 0 20.7501C0 21.7166 0.783508 22.5001 1.75002 22.5001H26.25C27.2165 22.5001 28 21.7166 28 20.7501C28 19.7836 27.2165 19.0001 26.25 19.0001Z" fill="white"/>
<path d="M26.25 9.5H1.75002C0.783509 9.5 0 10.2835 0 11.25C0 12.2165 0.783508 13 1.75002 13H26.25C27.2165 13 28 12.2165 28 11.25C28 10.2835 27.2165 9.5 26.25 9.5Z" fill="white"/>
<path d="M26.25 0H1.75002C0.783509 0 0 0.783509 0 1.75002C0 2.71652 0.783508 3.50003 1.75002 3.50003H26.25C27.2165 3.50003 28 2.71652 28 1.75002C28 0.783509 27.2165 0 26.25 0Z" fill="white"/>
</svg>

After

Width:  |  Height:  |  Size: 688 B

View File

@ -0,0 +1,40 @@
import React from "react";
import style from "./header-top.module.scss";
import logo from "../assets/svgs/m3-logo.svg";
import lupa from "../assets/svgs/lupa.svg";
import cart from "../assets/svgs/buying-cart.svg";
import menuIcon from "../assets/svgs/menu-hamburguer.svg";
const HeaderTop = () => {
return (
<header className={style["header-top-container"]}>
<div className={style["header-top-wrapper"]}>
<figure className={style["menu-hamburger"]}>
<img src={menuIcon} alt="Menu Mobile" />
</figure>
<figure className={style["m3-logo-wrapper"]}>
<img className={style["m3-logo"]} src={logo} alt="M3 Ecommerce" />
</figure>
<span className={style["search"]}>
<input
className={style["search-input"]}
type="search"
placeholder="Buscar..."
/>
<img className={style["search-img"]} src={lupa} alt="Search" />
</span>
<div className={style["cart-container"]}>
<span>entrar</span>
<figure>
<img src={cart} alt="Carrinho" />
</figure>
</div>
</div>
</header>
);
};
export { HeaderTop };

View File

@ -0,0 +1,124 @@
@use "../variables.module.scss";
.header-top-container {
width: 100%;
height: 76px;
background: variables.$color-black;
border-bottom: 1px solid variables.$color-grey;
@media screen and (max-width: 1024px) {
height: 139px;
}
input::placeholder {
font-weight: 400;
font-size: 14px;
line-height: 16px;
color: variables.$color-grey5;
}
.header-top-wrapper {
width: 80.46875%;
padding: 25px 0;
display: flex;
justify-content: space-between;
align-items: center;
margin: 0 auto;
@media screen and (max-width: 1024px) {
width: 100%;
padding: 25px 16px;
display: grid;
gap: 27.14px;
grid-template-columns: 1fr 1fr 1fr;
grid-template-rows: 1fr 1fr;
}
.menu-hamburger {
display: none;
@media screen and (max-width: 1024px) {
display: block;
}
}
.m3-logo-wrapper {
@media screen and (max-width: 1024px) {
grid-column: 2;
justify-content: center;
align-self: center;
display: flex;
}
}
.m3-logo {
display: block;
width: auto;
height: auto;
cursor: pointer;
}
.search {
position: relative;
@media screen and (max-width: 1024px) {
display: grid;
grid-column: 1/4;
grid-row: 2;
}
}
.search-input {
height: 32px;
min-width: 264px;
padding: 8px 16px;
border: 2px solid variables.$color-grey4;
border-radius: 5px;
outline: 0;
@media screen and (max-width: 1024px) {
min-width: 100%;
padding: 10px 16px;
height: 36px;
}
}
.search-img {
position: absolute;
right: 16px;
bottom: 8px;
cursor: pointer;
}
.cart-container {
display: flex;
align-items: center;
@media screen and (max-width: 1024px) {
justify-content: flex-end;
grid-column: 3;
}
span {
margin-right: 55px;
font-weight: 400;
font-size: 14px;
line-height: 16px;
text-transform: uppercase;
color: variables.$color-white;
text-align: center;
cursor: pointer;
@media screen and (max-width: 1024px) {
display: none;
}
}
figure {
cursor: pointer;
}
}
}
}

View File

@ -0,0 +1,25 @@
// 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;
// }
@use "variables.module.scss";
* {
padding: 0;
margin: 0;
box-sizing: border-box;
}
body {
font-family: "Roboto", sans-serif;
}

View File

@ -0,0 +1,13 @@
import React from "react";
import ReactDOM from "react-dom/client";
import "./globals.module.scss";
import { Home } from "./pages/Home";
const root = ReactDOM.createRoot(
document.getElementById("root") as HTMLElement
);
root.render(
<React.StrictMode>
<Home />
</React.StrictMode>
);

View File

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

View File

@ -0,0 +1 @@
/// <reference types="react-scripts" />

View File

@ -0,0 +1,21 @@
//fonts
@import url("https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap");
//colors
$color-black: #000000;
$color-black2: #292929;
$color-black3: #303030;
$color-white: #ffffff;
$color-grey: #c4c4c4;
$color-grey2: #e5e5e5;
$color-grey3: #7d7d7d;
$color-grey4: #f2f2f2;
$color-grey5: #c6c6c6;
$color-red: #ff0000;
$color-green: #008000;

View File

@ -0,0 +1,26 @@
{
"compilerOptions": {
"target": "es5",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noFallthroughCasesInSwitch": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx"
},
"include": [
"src"
]
}