-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'devel' of https://github.com/fga-eps-mds/2021.1-Oraculo…
…-FrontEnd into 121-cadastro-usuario-registros
- Loading branch information
Showing
9 changed files
with
268 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import React from "react"; | ||
import { StyledListGroup, StyledBigDiv, StyledText } from "./style"; | ||
|
||
const PocketUser = ({ user }) => { | ||
return ( | ||
<StyledListGroup> | ||
{user.map((singleUser) => ( | ||
<StyledBigDiv> | ||
<StyledText>{singleUser.name}</StyledText> | ||
<StyledText>{singleUser.email}</StyledText> | ||
</StyledBigDiv> | ||
))} | ||
</StyledListGroup> | ||
); | ||
}; | ||
|
||
export default PocketUser; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import styled from "styled-components"; | ||
|
||
export const StyledListGroup = styled.ul` | ||
display: contents; | ||
list-style-type: none; | ||
`; | ||
|
||
export const StyledBigDiv = styled.div` | ||
width: 100%; | ||
height: 5rem; | ||
margin-top: 2rem; | ||
border-radius: 15px; | ||
background: #ffffff; | ||
border: 2px solid #000000; | ||
`; | ||
|
||
export const StyledText = styled.text` | ||
margin: auto; | ||
text-align: center; | ||
width: 50%; | ||
background: transparent; | ||
font-family: Montserrat; | ||
font-style: normal; | ||
font-size: 26px; | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import React, { useState } from "react"; | ||
import HeaderWithButtons from "../../Components/HeaderWithButtons"; | ||
import MainButton from "../../Components/MainButton"; | ||
import SearchBar from "../../Components/SearchBar"; | ||
import toast, { Toaster } from "react-hot-toast"; | ||
import { history } from "../../history"; | ||
import { | ||
StyledTitle, | ||
StyledBottom, | ||
StyledOrganizeButtons, | ||
StyledBigButton, | ||
StyledSearchBarSize, | ||
StyledPage, | ||
StyledTop, | ||
StyledFooter, | ||
ButtonDiv, | ||
} from "./styles"; | ||
import { listAllUsers } from "../../Services/Axios/profileService"; | ||
import PocketUser from "../../Components/PocketUser"; | ||
|
||
const ViewAllUsers = () => { | ||
const [users, setUsers] = useState([]); | ||
|
||
const receiveUsers = async () => { | ||
setUsers(await listAllUsers(toast)); | ||
}; | ||
|
||
window.onload = function () { | ||
receiveUsers(); | ||
}; | ||
|
||
function handleCreateUser() { | ||
history.push("/criar-usuario"); | ||
window.location.reload(); | ||
} | ||
|
||
return ( | ||
<> | ||
<HeaderWithButtons /> | ||
<StyledPage> | ||
<StyledTitle>Usuários</StyledTitle> | ||
<StyledTop> | ||
<StyledSearchBarSize> | ||
<SearchBar /> | ||
</StyledSearchBarSize> | ||
<ButtonDiv> | ||
<MainButton onClick={handleCreateUser} title={"Criar Usuário"} /> | ||
</ButtonDiv> | ||
</StyledTop> | ||
<StyledBottom> | ||
<StyledOrganizeButtons> | ||
<StyledBigButton>Nome</StyledBigButton> | ||
<StyledBigButton>Email</StyledBigButton> | ||
</StyledOrganizeButtons> | ||
{users ? ( | ||
<PocketUser user={users} /> | ||
) : ( | ||
<StyledTitle>Não há usuários cadastrados</StyledTitle> | ||
)} | ||
<StyledFooter> | ||
<StyledBigButton>Nome</StyledBigButton> | ||
<StyledBigButton>Email</StyledBigButton> | ||
</StyledFooter> | ||
</StyledBottom> | ||
</StyledPage> | ||
<Toaster></Toaster> | ||
</> | ||
); | ||
}; | ||
|
||
export default ViewAllUsers; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
import styled from "styled-components"; | ||
import { colors } from "../../style"; | ||
|
||
export const styles = {}; | ||
|
||
export const StyledPage = styled.div` | ||
display: -ms-flexbox; | ||
align-items: center; | ||
margin-inline: 15rem; | ||
`; | ||
|
||
export const StyledTitle = styled.h1` | ||
margin-top: 4rem; | ||
margin-bottom: 3rem; | ||
font-family: Montserrat; | ||
font-style: normal; | ||
font-weight: normal; | ||
font-size: 40px; | ||
line-height: 49px; | ||
display: flex; | ||
text-align: left; | ||
color: #000000; | ||
`; | ||
|
||
export const StyledTop = styled.div` | ||
display: inline-flex; | ||
align-items: center; | ||
width: 100%; | ||
justify-content: space-between; | ||
@media only screen and (max-width: 1300px) { | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: safe; | ||
margin-top: 1rem; | ||
} | ||
`; | ||
|
||
export const StyledSearchBarSize = styled.div` | ||
width: 30rem; | ||
@media only screen and (max-width: 1300px) { | ||
width: 100%; | ||
margin-bottom: 1rem; | ||
} | ||
`; | ||
|
||
export const StyledBottom = styled.div` | ||
margin-bottom: 2rem; | ||
div { | ||
display: flex; | ||
justify-content: space-between; | ||
margin: 2rem 0 0 0; | ||
} | ||
`; | ||
|
||
export const StyledOrganizeButtons = styled.div` | ||
background: #1f3541; | ||
border: 0px solid #5e5e5e; | ||
box-sizing: border-box; | ||
border-radius: 10px 10px 0px 0px; | ||
height: 4rem; | ||
align-items: center; | ||
`; | ||
|
||
export const StyledBigButton = styled.button` | ||
width: 50%; | ||
height: 3rem; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
font-family: Montserrat; | ||
color: #ffffff; | ||
font-style: normal; | ||
font-size: 28px; | ||
line-height: 20px; | ||
text-align: center; | ||
background: transparent; | ||
cursor: pointer; | ||
border: none; | ||
`; | ||
|
||
export const StyledScroll = styled.div` | ||
height: 20rem; | ||
`; | ||
|
||
export const StyledFooter = styled.div` | ||
height: 4rem; | ||
width: 100%; | ||
background-color: ${colors.header}; | ||
border-radius: 0px 0px 10px 10px; | ||
align-items: center; | ||
`; | ||
|
||
export const ButtonDiv = styled.div` | ||
width: 19.5rem; | ||
align-items: center; | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters