Skip to content

Commit 8a76f14

Browse files
committed
add navbar for dashboard
1 parent 3891010 commit 8a76f14

File tree

5 files changed

+144
-0
lines changed

5 files changed

+144
-0
lines changed

app/src/Dashboard/FormsContainer.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import React from 'react';
22
import { Link } from 'react-router-dom';
33

44
import { gql, useQuery } from '@apollo/client';
5+
6+
57
import Form from './Form.jsx';
68

79
// Implement Apollo Client useQuery hook to retrieve data from the server through graphQL. This includes 2 steps:

app/src/Dashboard/NavbarDd.tsx

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
import React, { useState, useContext } from 'react';
2+
import {
3+
withStyles,
4+
createStyles,
5+
makeStyles,
6+
Theme,
7+
} from '@material-ui/core/styles';
8+
import AppBar from '@material-ui/core/AppBar';
9+
import Avatar from '@material-ui/core/Avatar';
10+
import Toolbar from '@material-ui/core/Toolbar';
11+
import Typography from '@material-ui/core/Typography';
12+
import IconButton from '@material-ui/core/IconButton';
13+
import MenuIcon from '@material-ui/icons/Menu';
14+
import Menu from '@material-ui/core/Menu';
15+
import MenuItem from '@material-ui/core/MenuItem';
16+
import List from '@material-ui/core/List';
17+
import ListItem from '@material-ui/core/ListItem';
18+
import ListItemText from '@material-ui/core/ListItemText';
19+
import ListItemIcon from '@material-ui/core/ListItemIcon';
20+
// ROUTING TO DASHBOARD
21+
import { Link } from 'react-router-dom';
22+
import { styleContext } from '../containers/AppContainer';
23+
import StateContext from '../../context/context';
24+
import logo from '../../../resources/icon.png';
25+
26+
import SortMenu from './SortMenu';
27+
28+
29+
30+
31+
// NavBar text and button styling
32+
const useStyles = makeStyles((theme: Theme) => createStyles({
33+
root: {
34+
flexGrow: 1,
35+
width: '100%',
36+
},
37+
menuButton: {
38+
marginRight: theme.spacing(2),
39+
color: 'white',
40+
},
41+
title: {
42+
flexGrow: 1,
43+
color: 'white',
44+
},
45+
manageProject: {
46+
display: 'flex',
47+
justifyContent: 'center',
48+
},
49+
}));
50+
51+
export default function NavBar(props) {
52+
const classes = useStyles();
53+
54+
const { style, setStyle } = useContext(styleContext);
55+
// added className="navbarButton" to test for buttons in enzyme.test.tsx
56+
return (
57+
<div className={classes.root} style={style}>
58+
<AppBar position="static">
59+
<Toolbar>
60+
<Avatar src={logo}></Avatar>
61+
<Typography variant="h6" style={{ marginLeft: '1rem' }} className={classes.title}>
62+
ReacType
63+
</Typography>
64+
65+
{/* ==================================Sort by Button================================================== */}
66+
67+
{/* //drop down menu logic goes here */}
68+
<SortMenu/>
69+
</Toolbar>
70+
</AppBar>
71+
</div>
72+
);
73+
}

app/src/Dashboard/ProjectContainer.jsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import React from 'react';
22
import { Link } from 'react-router-dom';
33

44
import { gql, useQuery } from '@apollo/client';
5+
import SortBy from './SortMenu.jsx';
6+
import Navbar from './NavbarDd.tsx';
57

68
import Project from './Project.jsx';
79
// Implement Apollo Client useQuery hook to retrieve data from the server through graphQL. This includes 2 steps:
@@ -47,6 +49,7 @@ const ProjectContainer = () => {
4749

4850
return (
4951
<div>
52+
<Navbar/>
5053
<h1> Public Dashboard </h1>
5154
<Link to="/">
5255
<button type="button">Go Back</button>

app/src/Dashboard/SortMenu.jsx

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
// import { supportsResultCaching } from '@apollo/client/cache/inmemory/entityStore';
2+
import React, { useState } from 'react';
3+
import Button from '@material-ui/core/Button';
4+
5+
const sortByRating = () => {
6+
console.log("rating")
7+
};
8+
9+
const sortByDate = () => {
10+
console.log("date")
11+
};
12+
13+
const sortByUser = () => {
14+
console.log("user")
15+
};
16+
17+
export default function SortMenu() {
18+
19+
const [isOpen, setIsOpen] = useState(false);
20+
const toggling = () => setIsOpen(!isOpen);
21+
22+
return (
23+
<div style ={ { textDecoration: 'none' } }>
24+
<Button onClick={toggling}
25+
variant="contained"
26+
color="primary"
27+
style={{ minWidth: '137.69px' }}
28+
className="navbarButton"
29+
id="navbarButtonDash"
30+
>
31+
Sort documents
32+
</Button>
33+
34+
{
35+
isOpen && (
36+
<div className="sortDoc">
37+
<Button
38+
variant="contained"
39+
color="primary"
40+
style={{ minWidth: '137.69px' }}
41+
className="navbarButton"
42+
id="ratingButton"
43+
onClick={sortByRating}
44+
> rating </Button>
45+
<Button
46+
variant="contained"
47+
color="primary"
48+
style={{ minWidth: '137.69px' }}
49+
className="navbarButton"
50+
id="dateButton"
51+
onClick={sortByDate}
52+
> date </Button>
53+
<Button
54+
variant="contained"
55+
color="primary"
56+
style={{ minWidth: '137.69px' }}
57+
className="navbarButton"
58+
id="userButton"
59+
onClick={sortByUser}
60+
> user </Button>
61+
</div>
62+
)
63+
}
64+
</div>
65+
)
66+
}

app/src/Dashboard/navbar.jsx

Whitespace-only changes.

0 commit comments

Comments
 (0)