Skip to content

Commit

Permalink
feat: add new header
Browse files Browse the repository at this point in the history
  • Loading branch information
ialexanderbrito committed Apr 6, 2022
1 parent e5f6b42 commit d995e76
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 179 deletions.
131 changes: 0 additions & 131 deletions src/components/Header/Header.module.scss
Original file line number Diff line number Diff line change
@@ -1,131 +0,0 @@
.header {
display: flex;
width: 100%;
height: 70px;
align-items: center;

background: var(--black-medium);
}

.logo {
width: 90px;
height: 60px;
margin-left: 10px;
display: none;
}

.avatar {
width: 42px;
height: 42px;
border-radius: 42px;
box-sizing: border-box;
display: flex;
justify-content: center;
align-items: center;
user-select: none;
object-fit: cover;
}

.user {
display: flex;
align-items: center;
margin-left: 10px;
height: 100px;
width: 80%;
}

.bemVindo {
display: flex;
flex-direction: column;
justify-content: center;
margin-left: 1rem;
color: var(--gray);
font-size: 16px;

p {
margin-top: 0;
color: var(--orange);
font-size: 16px;

cursor: pointer;
}
}

.icon {
color: var(--gray);
cursor: pointer;
margin-right: 40px;

&:hover {
color: var(--orange);
filter: brightness(0.8);
transition: 0.4s;
}
}

@media screen and (min-width: 839px) {
.header {
display: flex;
width: 100%;
height: 120px;
align-items: center;

background: var(--black-medium);
}

.logo {
width: 137px;
height: 80px;
margin-left: 160px;
display: flex;
}

.avatar {
width: 42px;
height: 42px;
border-radius: 42px;
box-sizing: border-box;
display: flex;
justify-content: center;
align-items: center;
user-select: none;
object-fit: cover;
}

.user {
display: flex;
align-items: center;
margin-left: 40px;
height: 100px;
width: 80%;
}

.bemVindo {
display: flex;
flex-direction: column;
justify-content: center;
margin-left: 1rem;
color: var(--gray);
font-size: 16px;

p {
margin-top: 0;
color: var(--orange);
font-size: 16px;

cursor: pointer;
}
}

.icon {
color: var(--gray);
cursor: pointer;
margin-right: 40px;

&:hover {
color: var(--orange);
filter: brightness(0.8);
transition: 0.4s;
}
}
}
63 changes: 15 additions & 48 deletions src/components/Header/index.tsx
Original file line number Diff line number Diff line change
@@ -1,62 +1,29 @@
import { IoMdLogOut, IoMdMoon, IoMdSunny } from 'react-icons/io';
import { IoArrowBackOutline } from 'react-icons/io5';
import { useNavigate } from 'react-router-dom';
import { IoMdMoon, IoMdSunny } from 'react-icons/io';
import { RiArrowDownSFill } from 'react-icons/ri';

import logo from 'assets/Logo.png';
import Avvvatars from 'avvvatars-react';
import { HeaderProps } from 'types/IComponents';

import { useTheme } from 'contexts/Theme';

import { useAuth } from 'hooks/useAuth';
import { DropdownMenu } from 'components/DropdownMenu';
import { Navbar } from 'components/Navbar';
import { NavItem } from 'components/NavItem';

import styles from './Header.module.scss';
import { useTheme } from 'contexts/Theme';

export function Header(props: HeaderProps) {
const navigate = useNavigate();
const { theme, switchTheme } = useTheme();
const { handleLogout } = useAuth();

return (
<div className={styles.header}>
{props.logo && <img src={logo} alt="Logo" className={styles.logo} />}
<div className={styles.user}>
{props.back && <IoArrowBackOutline size={32} className={styles.icon} onClick={() => navigate('/')} />}
{props.default ? (
<>
{props.profile ? (
<img src={props.profile} alt="Avatar" className={styles.avatar} />
) : (
<Avvvatars value={props.avatar || ''} size={42} />
)}
</>
) : null}

{props.name && (
<div className={styles.bemVindo}>
Bem vindo,
<p
onClick={() => {
navigate('/profile');
}}
>
{props.name}
</p>
</div>
)}
</div>
<div
<Navbar logo={props.logo} back={props.back}>
<NavItem
onClick={() => {
switchTheme();
}}
>
{theme === 'light' ? (
<IoMdMoon size={32} className={styles.icon} />
) : (
<IoMdSunny size={32} className={styles.icon} />
)}
</div>
<IoMdLogOut onClick={() => handleLogout()} size={32} className={styles.icon} />
</div>
icon={theme === 'light' ? <IoMdMoon /> : <IoMdSunny />}
/>

<NavItem icon={<RiArrowDownSFill />}>
<DropdownMenu></DropdownMenu>
</NavItem>
</Navbar>
);
}

0 comments on commit d995e76

Please sign in to comment.