feat(header): add CSS Modules

This commit is contained in:
Ana Carolina Duarte Cavalcante 2023-01-06 10:59:26 -03:00
parent 7b940e23c5
commit a1ff718a82
4 changed files with 34 additions and 16 deletions

View File

@ -387,3 +387,5 @@ header {
border-top-width: 0px;
}
}

View File

@ -1,5 +1,5 @@
import { HeaderContentTop } from "./HeaderContentTop";
import "./Header.scss";
import styles from "./Header.module.scss"
import { HeaderContentBottom } from "./HeaderContentBottom";
import {useState} from "react";
import Icon__Menu from "../../assets/imgs/IconMenu.svg";
@ -10,9 +10,9 @@ const Header = () => {
return (
<header>
<ul className="Header__Top">
<button className="Header__Button" onClick={() => setMenuIsVisible(true)} aria-label="abrir menu">
<img src={Icon__Menu} alt="ícone de menu" className="Icon__Menu" />
<ul className={styles["Header__Top"]}>
<button className={styles["Header__Button"]} onClick={() => setMenuIsVisible(true)} aria-label="abrir menu">
<img src={Icon__Menu} alt="ícone de menu" className={styles["Icon__Menu"]} />
</button>
<HeaderContentTop menuIsVisible={menuIsVisible} setMenuIsVisible={setMenuIsVisible}/>
</ul>

View File

@ -1,4 +1,4 @@
import "./Header.scss"
import styles from "./Header.module.scss"
import React from "react";
interface HeaderContentProps {
@ -9,8 +9,18 @@ interface HeaderContentProps {
const HeaderContentBottom = ({menuIsVisible,setMenuIsVisible}: HeaderContentProps) => {
return (
<>
<div className={`Header__Bottom ${menuIsVisible && 'opened'}`} onClick={() => setMenuIsVisible(false)} >
<nav className={`Nav__Bar ${menuIsVisible && 'opened'}`} onClick={() => setMenuIsVisible(false)} >
<div className={
menuIsVisible
? `${styles['Header__Bottom']} ${styles['opened']}`
: `${styles['Header__Bottom']}`
} onClick={() => setMenuIsVisible(false)} >
<nav className={
menuIsVisible
? `${styles["Nav__Bar"]} ${styles['opened']}`
: `${styles["Nav__Bar"]}`
} onClick={() => setMenuIsVisible(false)} >
<ul className={`${menuIsVisible && 'opened'}`} onClick={() => setMenuIsVisible(false)}>
<li>
<a href="/">Cursos</a>

View File

@ -1,5 +1,5 @@
import React from "react";
import "./Header.scss";
import styles from "./Header.module.scss"
import Logo from "../../assets/imgs/logom3.svg";
import Cart from "../../assets/imgs/cart.svg";
import Icon__Menu__Closed from "../../assets/imgs/IconMenuClosed.svg";
@ -15,13 +15,13 @@ const HeaderContentTop = ({menuIsVisible,setMenuIsVisible}: HeaderContentProps)
return (
<>
<li className="Logo">
<li className={styles["Logo"]}>
<a href="/">
<img src={Logo} alt="logo M3" />
</a>
</li>
<input
className="Search__Bar"
className={styles["Search__Bar"]}
type="text"
placeholder="Buscar..."
value={search}
@ -29,15 +29,21 @@ const HeaderContentTop = ({menuIsVisible,setMenuIsVisible}: HeaderContentProps)
setSearch(e.target.value)
}
></input>
<ul className="Menu__Header__Top">
<li className={`List__Login ${menuIsVisible && 'opened'}`} onClick={() => setMenuIsVisible(false)}>
<ul className={styles["Menu__Header__Top"]}>
<li className={
menuIsVisible
? `${styles['List__Login']} ${styles['opened']}`
: `${styles['List__Login']}`
} onClick={() => setMenuIsVisible(false)}>
<a href="/">Entrar</a>
<button className="Header__Button Closed" onClick={() => setMenuIsVisible(false)} aria-label="fechar menu">
<img src={Icon__Menu__Closed} alt="ícone do menu pra fechar" className="Icon__Menu__Closed"/>
<button className={
`${styles["Header__Button"]} ${styles["Closed"]}`
} onClick={() => setMenuIsVisible(false)} aria-label="fechar menu">
<img src={Icon__Menu__Closed} alt="ícone do menu pra fechar" className={styles["Icon__Menu__Closed"]}/>
</button>
</li>
<li className="List__Cart">
<a href="/" className="cart__content--link">
<li className={styles["List__Cart"]}>
<a href="/" className={styles["cart__content--link"]}>
<img src={Cart} alt="ícone de carrinho" />
</a>
</li>