Skip to content

Commit

Permalink
feat: add pages admin
Browse files Browse the repository at this point in the history
  • Loading branch information
ialexanderbrito committed Apr 11, 2022
1 parent 6acc098 commit b42462d
Show file tree
Hide file tree
Showing 2 changed files with 146 additions and 0 deletions.
87 changes: 87 additions & 0 deletions src/pages/Admin/Admin.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
.home {
background: var(--background);
height: 100vh;
}

.container {
display: flex;
flex-direction: column;
align-items: center;
justify-content: flex-start;
background: var(--background);
}

.titleHome {
margin-top: 24px;
margin-bottom: 24px;
font-weight: bold;
color: var(--white);
margin-left: 18px;
margin-right: 18px;
font-size: 22px;
}

.titleContainer {
margin-top: 24px;
margin-bottom: 24px;
font-weight: bold;
color: var(--white);
margin-left: 12px;
font-size: 22px;
flex-direction: row;
display: flex;
align-items: center;
width: 90%;
justify-content: space-around;

font-size: 14px;
}

.containerList {
display: flex;
width: 100%;
align-items: center;
justify-content: center;
flex-direction: column;
}

.containerBarber {
display: flex;
width: 25rem;
align-items: center;
justify-content: space-around;
}

.button {
border: none;
background: var(--orange);
cursor: pointer;
border-radius: 10px;
width: 60px;
height: 60px;
align-items: center;
justify-content: center;

&:hover {
filter: brightness(0.6);
transition: 0.4s;
}
}

@media screen and (min-width: 839px) {
.titleContainer {
margin-top: 24px;
margin-bottom: 24px;
font-weight: bold;
color: var(--white);
margin-left: 12px;
font-size: 22px;
flex-direction: row;
display: flex;
align-items: center;
width: 30rem;
justify-content: space-around;

font-size: 18px;
}
}
59 changes: 59 additions & 0 deletions src/pages/Admin/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import { FiCheck } from 'react-icons/fi';

import { SpinnerCircular } from 'spinners-react';
import { UserMetadata } from 'types/IContext';

import { CardBarbeiro } from 'components/CardBarbeiro';
import { Header } from 'components/Header';

import { useTheme } from 'contexts/Theme';

import { useAdmin } from 'hooks/useAdmin';

import styles from './Admin.module.scss';

export function Admin() {
const { theme } = useTheme();
const { loading, aproveBarbeiro, barbeiros } = useAdmin();

return (
<>
<div className={styles.home} data-theme={theme}>
<Header logo />
<div className={styles.container}>
<div className={styles.titleContainer}>
{barbeiros.length > 0 ? (
<h2 className={styles.titleHome}>Barbeiros para serem aprovados</h2>
) : (
<h2 className={styles.titleHome}>Não há barbeiros para serem aprovados.</h2>
)}
</div>

<div className={styles.containerList}>
{loading ? (
<SpinnerCircular color="#ff9000" size={64} />
) : (
<>
{barbeiros.length > 0 &&
barbeiros.map((barbeiro: UserMetadata) => (
<div className={styles.containerBarber}>
<CardBarbeiro key={barbeiro.id} barbeiro={barbeiro} />
<button
className={styles.button}
onClick={() => {
console.log('click');
aproveBarbeiro(barbeiro?.id);
}}
>
<FiCheck color="#FFF" size={28} style={{ marginTop: '6px' }} />
</button>
</div>
))}
</>
)}
</div>
</div>
</div>
</>
);
}

0 comments on commit b42462d

Please sign in to comment.