diff --git a/desafio-5/src/assets/icones/menuHamburguer-icon.svg b/desafio-5/src/assets/icones/menuHamburguer-icon.svg new file mode 100644 index 0000000..c1b3e34 --- /dev/null +++ b/desafio-5/src/assets/icones/menuHamburguer-icon.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/desafio-5/src/components/Header/SubMenu.tsx b/desafio-5/src/components/Header/SubMenu.tsx index 65f6686..d6c0e16 100644 --- a/desafio-5/src/components/Header/SubMenu.tsx +++ b/desafio-5/src/components/Header/SubMenu.tsx @@ -1,5 +1,6 @@ -import React from "react"; +import React, { useContext } from "react"; import style from "../../styles/header/submenu.module.scss"; +import { HeaderContext } from "../../contexts/HeaderContext"; @@ -7,7 +8,8 @@ import style from "../../styles/header/submenu.module.scss"; const Submenu = () => { - + const { open, menu } = useContext(HeaderContext); + return (
@@ -26,6 +28,32 @@ const Submenu = () => {
+
+
menu(false)} + className={`${style["submenu--absolute"]} ${ + open == true ? style["is-open"] : "" + }`} + >
+
+ + ENTRAR + + + CURSOS + + + SAIBA MAIS + + + INSTIUCIONAL + +
+
); diff --git a/desafio-5/src/components/Header/header.tsx b/desafio-5/src/components/Header/header.tsx index 9e6fda2..36ca687 100644 --- a/desafio-5/src/components/Header/header.tsx +++ b/desafio-5/src/components/Header/header.tsx @@ -2,19 +2,21 @@ import React from "react"; import style from "../../styles/header/header.module.scss"; -import logo from "../../assets/logos/logo-m3Academy.svg"; + import { MenuHeader } from "./menuHeader"; import { Submenu } from "./SubMenu" +import { HeaderProvider } from "../../contexts/HeaderContext"; const Header = () => { return ( - +
< Submenu />
+
) diff --git a/desafio-5/src/components/Header/menuHeader.tsx b/desafio-5/src/components/Header/menuHeader.tsx index eecb061..7e511b0 100644 --- a/desafio-5/src/components/Header/menuHeader.tsx +++ b/desafio-5/src/components/Header/menuHeader.tsx @@ -3,14 +3,19 @@ import React, { useContext } from "react"; import style from "../../styles/header/headermenu.module.scss"; import logo from "../../assets/logos/Logo-M3Academy 1m3academy-header.svg"; import CartIcon from "../../assets/icones/shoppingCart-icon.svg"; +import { ReactComponent as MenuIcon } from "../../assets/icones/menuHamburguer-icon.svg"; import { BuscaMenu } from "./BuscaMenu"; +import { HeaderContext } from "../../contexts/HeaderContext"; const MenuHeader = () => { - + const { menu } = useContext(HeaderContext); return (
+
menu(true)} className={style["icon-menu"]}> + +
Logo M3 @@ -20,7 +25,7 @@ const MenuHeader = () => { ENTRAR
diff --git a/desafio-5/src/contexts/HeaderContext.tsx b/desafio-5/src/contexts/HeaderContext.tsx new file mode 100644 index 0000000..f978532 --- /dev/null +++ b/desafio-5/src/contexts/HeaderContext.tsx @@ -0,0 +1,25 @@ +import React, { createContext, ReactNode, useState } from "react"; + +const HeaderContext = createContext({} as IValues); + +interface Props { + children: ReactNode; +} + +interface IValues{ + open: boolean, + menu: (stateMenu: boolean) => void +} + +const HeaderProvider = ({ children }: Props) => { + const [open, setOpen] = useState(false); + + function menu(stateMenu:boolean){ + setOpen(stateMenu); + } + + return {children}; +}; + +export { HeaderProvider }; +export { HeaderContext }; \ No newline at end of file diff --git a/desafio-5/src/contexts/PageContext.tsx b/desafio-5/src/contexts/PageContext.tsx new file mode 100644 index 0000000..b695541 --- /dev/null +++ b/desafio-5/src/contexts/PageContext.tsx @@ -0,0 +1,25 @@ +import React, { createContext, ReactNode, useEffect, useState } from "react"; + +const PageContext = createContext({} as IValues); + +interface Props { + children: ReactNode; +} + +interface IValues{ + content: string, + aba: (contentSelect: string) => void +} + +const PageProvider = ({ children }: Props) => { + const [content, setContent] = useState('Sobre'); + + function aba(contentSelect:string){ + setContent(contentSelect); + } + + return {children}; +}; + +export { PageProvider }; +export { PageContext }; diff --git a/desafio-5/src/styles/header/submenu.module.scss b/desafio-5/src/styles/header/submenu.module.scss index cccd518..d2a5ad1 100644 --- a/desafio-5/src/styles/header/submenu.module.scss +++ b/desafio-5/src/styles/header/submenu.module.scss @@ -14,12 +14,12 @@ .submenu-links--desktop { max-width: 349px; - + width: 100%; justify-content: space-between; - + } .submenu-link { @@ -34,19 +34,19 @@ transition: color .2s linear; - + } .submenu-links--desktop .submenu-link { - color: var( --whiet-100); - + color: var(--whiet-100); + } .submenu-links--mobile { position: absolute; z-index: 5; top: 0; - width: 66%; + width: 94%; height: 100%; background-color: #fff; @@ -57,9 +57,7 @@ transition: all .2s .1s linear; } -.submenu-links .submenu-link:hover { - color: var(--black-300); -} + .submenu--absolute { position: absolute; @@ -81,17 +79,18 @@ //midia @media screen and (min-width: 2500px) { -.submenu-links--desktop { + .submenu-links--desktop { max-width: 568.62px; } - .submenu-link{ + + .submenu-link { font-weight: 500; -font-size: 28px; -line-height: 3 + font-size: 28px; + line-height: 3 } - } +} @media screen and (max-width: 1024px) { .submenu { @@ -108,10 +107,26 @@ line-height: 3 width: 100%; padding: 10px 0; - text-align: center; - color: var(--blue-500); + // text-align: center; + color: var(--gray-400); - border-bottom: 1px solid var(--blue-500); + + } + + .submenu-link-entre { + width: 100%; + + + padding: 31px 0 31px 16px; + background-color: var(--black-600); + font-weight: 400; + font-size: 14px; + line-height: 16px; + text-transform: uppercase; + + color: var(--gray-400); + color: #FFFFFF; + text-decoration: none; } .submenu--absolute.is-open {