From f25f18824c175d71678f10c154195a7a9595022d Mon Sep 17 00:00:00 2001 From: amanda almeida Date: Fri, 30 Dec 2022 00:20:23 -0300 Subject: [PATCH] feat(menu): adiciona menu mobile --- src/assets/img/iconExit.png | Bin 0 -> 268 bytes src/assets/img/iconMenu.png | Bin 0 -> 217 bytes src/components/Header.tsx | 47 +++++++++++---- src/components/HeaderLinks.tsx | 13 ++++ src/components/Link.tsx | 3 +- src/components/menuMobile.tsx | 32 ++++++++++ src/styles/header.scss | 106 +++++++++++++++++++++++++++++++-- 7 files changed, 185 insertions(+), 16 deletions(-) create mode 100644 src/assets/img/iconExit.png create mode 100644 src/assets/img/iconMenu.png create mode 100644 src/components/HeaderLinks.tsx create mode 100644 src/components/menuMobile.tsx diff --git a/src/assets/img/iconExit.png b/src/assets/img/iconExit.png new file mode 100644 index 0000000000000000000000000000000000000000..2dd684580ca3b8989addd96af5aa91420fbf406e GIT binary patch literal 268 zcmeAS@N?(olHy`uVBq!ia0vp^{2``W z$lZxy-8q?;Kn_c~qpu?a!^VE@KZ&eB{z6X|$B+ufxsw_N9SnFFjGF|lngnwWahR>( zz0ttilfa@ZaggKUE+wUxTmR`j_praTg@Ms!O^pM~bp4nqe-4mCk zHOb14TwSA|T@fsNn!7cK(Q{998mm>0a`%!0AG~>rR-RCEy|elMnvOrUQ;tMMSS+mZ zu@&X5lZ==rzU@}St`^<5CNIyI7hY_#JJWW;_=(WA2kSpseq~-A@q6bP0l+XkKJ=|fL literal 0 HcmV?d00001 diff --git a/src/assets/img/iconMenu.png b/src/assets/img/iconMenu.png new file mode 100644 index 0000000000000000000000000000000000000000..2b91465017ad0283f5b7ed3dbaa75926bc3fcc45 GIT binary patch literal 217 zcmeAS@N?(olHy`uVBq!ia0vp^GC(ZO!3HEHPU(jODb50q$YKTtZeb8+WSBKa0w~B> z9OUlAuz9ExGkCiC KxvX { + const activeMenuMobile = async () => { + const menu = document.querySelector(".page-header__menu-mobile"); + if (menu?.classList.contains("active")) { + menu?.classList.remove("active"); + } else { + menu?.classList.add("active"); + } + }; + return (
-
- - -
- - - +
- - - +
); diff --git a/src/components/HeaderLinks.tsx b/src/components/HeaderLinks.tsx new file mode 100644 index 0000000..b40da5c --- /dev/null +++ b/src/components/HeaderLinks.tsx @@ -0,0 +1,13 @@ +import Link from "./Link"; + +const HeaderLinks = () => { + return ( + <> + + + + + ); +}; + +export default HeaderLinks; diff --git a/src/components/Link.tsx b/src/components/Link.tsx index 4d2e2f5..c3b0eee 100644 --- a/src/components/Link.tsx +++ b/src/components/Link.tsx @@ -1,12 +1,11 @@ export interface LinkProps { link: string; text: string; - className: string; } const Link = (props: LinkProps) => { return ( - + {props.text} ); diff --git a/src/components/menuMobile.tsx b/src/components/menuMobile.tsx new file mode 100644 index 0000000..0611e05 --- /dev/null +++ b/src/components/menuMobile.tsx @@ -0,0 +1,32 @@ +import iconExit from "../assets/img/iconExit.png"; +import Link from "./Link"; +import HeaderLinks from "./HeaderLinks"; + +interface MenuMobileProps { + onClick: React.MouseEventHandler; +} + +const MenuMobile = (props: MenuMobileProps) => { + return ( +
+
+
+ + +
+
+ +
+
+
+ ); +}; + +export default MenuMobile; diff --git a/src/styles/header.scss b/src/styles/header.scss index 22077df..804e099 100644 --- a/src/styles/header.scss +++ b/src/styles/header.scss @@ -9,8 +9,8 @@ flex-direction: row; justify-content: space-between; align-items: center; - border-bottom: 1px solid $gray-600; - padding: 0 100px; + + } &__busca { @@ -19,7 +19,7 @@ } &__busca-input { - width: 248px; + width: 98.6%; height: 32px; background: $white; border: 2px solid $gray-700; @@ -52,7 +52,7 @@ gap: 55px; } - &__link { + .link { font-weight: 400; font-size: 14px; line-height: 16px; @@ -68,4 +68,102 @@ align-items: center; gap: 55px; } + + &__menu-button { + background: transparent; + border: 0; + cursor: pointer; + } + + &__menu-mobile { + position: absolute; + top: 0; + left: 0; + background: rgba(69, 69, 69, 0.7); + width: 100%; + height: 100%; + z-index: 50; + display: none; + + &--container { + height: 585px; + background: $white; + width: 96.5%; + } + + &--header { + display: flex; + justify-content: space-between; + align-items: center; + background: $black; + padding: 31px 16px; + } + + &--button-exit { + background: transparent; + border: 0; + outline: 0; + cursor: pointer; + } + + &--links { + display: flex; + flex-direction: column; + align-self: start; + gap: 12px; + padding: 31px 0 0 16px; + + .link { + color: #C4C4C4; + } + } + + } + + &__mobile { + padding: 0 16px 25px; + } + + .active { + display: block; + } + + + + @media screen and (min-width: 1025px) { + &__container-top { + padding: 0 100px; + border-bottom: 1px solid $gray-600; + } + + &__menu, + &__mobile { + display: none; + } + } + + @media screen and (max-width: 1024px) { + + &__container-top { + padding: 0 16px; + + .page-header__busca { + display: none; + } + } + + &__container-login { + .link { + display: none; + } + } + + &__container-bottom { + display: none; + } + + &__busca { + width: 100%; + } + } } \ No newline at end of file