Skip to content

Commit

Permalink
Merge pull request #9 from lizzypy/use-next-layout
Browse files Browse the repository at this point in the history
use next layout
  • Loading branch information
lizzypy authored Sep 17, 2023
2 parents 25c1d64 + 34619d7 commit d30c99d
Show file tree
Hide file tree
Showing 10 changed files with 87 additions and 34 deletions.
3 changes: 3 additions & 0 deletions frontend/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
/node_modules
/.pnp
.pnp.js
.next
*.swp
.idea

# testing
/coverage
Expand Down
9 changes: 9 additions & 0 deletions frontend/pages/_app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import Layout from '../src/components/layout'

export default function MyApp({ Component, pageProps }) {
return (
<Layout>
<Component {...pageProps} />
</Layout>
)
}
1 change: 0 additions & 1 deletion frontend/pages/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import usersPage from './welcome'

export default usersPage

Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import React, {useState} from "react";
import {Button, Container, Typography} from '@material-ui/core'
import {Button, Container, Typography, MenuItem} from '@material-ui/core'
import axios from 'axios';
import {Box, Input, Modal} from "@mui/material";
import Link from "next/link";

const style = {
position: 'absolute' as 'absolute',
Expand All @@ -17,7 +18,7 @@ const style = {
pb: 3,
};

function SignUpForm() {
const Navbar = () => {
const [open, setOpen] = useState<boolean>(false)
const [signInOpen, setSignInOpen] = useState<boolean>(false)
const [email, setEmail] = useState("");
Expand Down Expand Up @@ -70,9 +71,62 @@ function SignUpForm() {

return (
<>
<Button onClick={handleOpen}>Sign Up</Button>
<Button onClick={handleSignInOpen}>Sign In</Button>
<section aria-label={"toolbar-section"}
style={{display: "flex", flexDirection: "row", justifyContent: "left"}}>
<MenuItem>
<Link
style={{
textDecoration: 'none',
color: '#000'
}}
href="/"
>
HOME
</Link>
</MenuItem>
<MenuItem>
<Link
style={{
textDecoration: 'none',
color: '#000'
}}
href="/users"
>
USERS
</Link>
</MenuItem>
<MenuItem>
<Link
style={{
textDecoration: 'none',
color: '#000'
}}
href="/participants"
>
PARTICIPANTS
</Link>
</MenuItem>
</section>
<section aria-label={"toolbar-section"}
style={{display: "flex", flexDirection: "row", justifyContent: "right"}}>

<MenuItem>
<Link
style={{
textDecoration: 'none',
color: '#000'
}}
href="/signup">SIGN UP
</Link>
</MenuItem>
<Button
style={{
textDecoration: 'none',
color: '#000'
}}
onClick={handleSignInOpen}>Sign In
</Button>
</section>
<Modal
open={open}
onClose={handleClose}
Expand Down Expand Up @@ -106,4 +160,4 @@ function SignUpForm() {
);
}

export default SignUpForm;
export default Navbar;
1 change: 0 additions & 1 deletion frontend/src/components/ParticipantsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import Box from '@mui/material/Box';
import {AppBar, Toolbar } from "@mui/material";
import useParticipants from "../hooks/useParticipants";
import type {NextPage} from 'next';
import SignUpForm from "../components/signUpForm";
import {Typography} from "@material-ui/core";

const ParticipantsList = () => {
Expand Down
15 changes: 15 additions & 0 deletions frontend/src/components/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import Navbar from './Navbar'
import {AppBar, Toolbar } from "@mui/material";

export default function Layout({ children }: any) {
return (
<>
<AppBar position="static" sx={{ bgcolor: "pink" }}>
<Toolbar>
<Navbar/>
</Toolbar>
</AppBar>
<main>{children}</main>
</>
)
}
1 change: 1 addition & 0 deletions frontend/src/hooks/useParticipants.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ describe('useParticipants', () => {
"last_name":"johnson",
"birthdate":"2016-04-16"
}])
console.log(result.current)
expect(mockHttpClient.get).toHaveBeenCalledWith('/participants')
})
})
Expand Down
9 changes: 0 additions & 9 deletions frontend/src/pages/Participants.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,10 @@
import ParticipantsList from "../components/ParticipantsList";
import {AppBar, Toolbar } from "@mui/material";
import SignUpForm from "../components/signUpForm";
import type {NextPage} from 'next';

export const Participants: NextPage = () => {
return (
<>
<AppBar position="static" sx={{ bgcolor: "pink" }}>
<section aria-label={"toolbar-section"}
style={{display: "flex", flexDirection: "row", justifyContent: "right"}}>
<Toolbar>
<SignUpForm/>
</Toolbar>
</section>
</AppBar>
<section aria-label={"participants-section"}
style={{
padding: "40px 30px",
Expand Down
9 changes: 0 additions & 9 deletions frontend/src/pages/Users.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import Box from '@mui/material/Box';
import {AppBar, Toolbar } from "@mui/material";
import useUsers from "../hooks/useUsers";
import type {NextPage} from 'next';
import SignUpForm from "../components/signUpForm";
import {Typography} from "@material-ui/core";

export const Users: NextPage = () => {
Expand All @@ -27,14 +26,6 @@ export const Users: NextPage = () => {

return (
<div>
<AppBar position="static" sx={{ bgcolor: "pink" }}>
<section aria-label={"toolbar-section"}
style={{display: "flex", flexDirection: "row", justifyContent: "right"}}>
<Toolbar>
<SignUpForm/>
</Toolbar>
</section>
</AppBar>
<section aria-label={"participants-section"}
style={{
padding: "40px 30px",
Expand Down
9 changes: 0 additions & 9 deletions frontend/src/pages/Welcome.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import Box from '@mui/material/Box';
import {AppBar, Toolbar } from "@mui/material";
import useUsers from "../hooks/useUsers";
import type {NextPage} from 'next';
import SignUpForm from "../components/signUpForm";
import ParticipantsList from "../components/ParticipantsList";
import {Typography} from "@material-ui/core";

Expand All @@ -28,14 +27,6 @@ export const Welcome: NextPage = () => {

return (
<div>
<AppBar position="static" sx={{ bgcolor: "pink" }}>
<section aria-label={"toolbar-section"}
style={{display: "flex", flexDirection: "row", justifyContent: "right"}}>
<Toolbar>
<SignUpForm/>
</Toolbar>
</section>
</AppBar>
<section aria-label={"participants-section"}
style={{
padding: "40px 30px",
Expand Down

0 comments on commit d30c99d

Please sign in to comment.