From 6e728b391ea90f882fdf538ab1caa9d6a2bf6047 Mon Sep 17 00:00:00 2001 From: WaleedGhori Date: Sat, 1 Apr 2023 00:33:01 +0500 Subject: [PATCH] fixed --- React-frontend/.gitignore | 2 +- React-frontend/package.json | 4 +- React-frontend/src/components/core/Navbar.js | 635 +++++++++++++------ 3 files changed, 455 insertions(+), 186 deletions(-) diff --git a/React-frontend/.gitignore b/React-frontend/.gitignore index 4d29575d..04c5395e 100644 --- a/React-frontend/.gitignore +++ b/React-frontend/.gitignore @@ -1,7 +1,7 @@ # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. # dependencies -/node_modules +node_modules /.pnp .pnp.js diff --git a/React-frontend/package.json b/React-frontend/package.json index 15125746..63bba394 100644 --- a/React-frontend/package.json +++ b/React-frontend/package.json @@ -39,8 +39,8 @@ "vega-lite-api": "^5.0.0" }, "scripts": { - "start": "react-scripts start", - "build": "react-scripts build", + "start": "react-scripts --openssl-legacy-provider start", + "build": "react-scripts --openssl-legacy-provider build", "test": "react-scripts test", "eject": "react-scripts eject" }, diff --git a/React-frontend/src/components/core/Navbar.js b/React-frontend/src/components/core/Navbar.js index ebb42590..9c6788b0 100644 --- a/React-frontend/src/components/core/Navbar.js +++ b/React-frontend/src/components/core/Navbar.js @@ -1,5 +1,4 @@ import React, { useState } from 'react' - import { AppBar, Button, @@ -14,7 +13,9 @@ import { MenuItem, Dialog, DialogContent, - DialogActions + DialogActions, + useMediaQuery, + useTheme, } from '@material-ui/core'; import { makeStyles } from '@material-ui/core/styles'; import { deepPurple } from '@material-ui/core/colors'; @@ -24,15 +25,18 @@ import { useSelector, useDispatch } from 'react-redux'; import { logout } from '../../store/actions/auth'; import RegisterForm from '../RegisterForm'; import LoginForm from '../LoginForm'; +import MenuIcon from '@mui/icons-material/Menu'; + const useStyles = makeStyles((theme) => ({ appBar: { - height: '8vh', + height: '10vh', borderBottom: `1px solid ${theme.palette.divider}`, backgroundColor: '#0f0f0f', color: '#fff', position: 'fixed', }, + toolbar: { flexWrap: 'wrap' }, @@ -49,13 +53,34 @@ const useStyles = makeStyles((theme) => ({ color: '#fff', } }, + responsnav: { + // marginTop:'2px', + background: '#818081', + height: '40vh', + width: '100%', + position: 'absolute', + top: '59px', + display: 'flex', + flexDirection: 'column', + alignItems: 'center', + transition:'0.2s', + transform:' translateX(1.5em)', + ['@media (min-width:599px)']: { // eslint-disable-line no-useless-computed-key + display: 'none', + }, + }, link: { margin: theme.spacing(1, 1.5), color: '#fff', '&:hover': { TextDecoration: 'none', color: '#fff' - } + }, + ['@media (max-width:599px)']: { // eslint-disable-line no-useless-computed-key + display: 'flex', + flexDirection: 'column', + alignItems:'center' + }, }, button: { marginRight: theme.spacing(0.7), @@ -68,7 +93,16 @@ const useStyles = makeStyles((theme) => ({ }, '&:focus': { outline: 'none' - } + }, + ['@media (max-width:599px)']: { // eslint-disable-line no-useless-computed-key + marginTop: theme.spacing(0.7), + }, + }, + avatarButton:{ + marginLeft:'auto', + ['@media (max-width:599px)']: { // eslint-disable-line no-useless-computed-key + marginLeft:'0px' + }, }, small: { position: 'relative', @@ -123,6 +157,10 @@ export function Header() { const auth = useSelector(state => state.auth) const [openLogin, setOpenLogin] = useState(false) const [openSignUp, setOpenSignUp] = useState(false) + const [resDrowp, setresDrowp] = useState(false) + + const theme = useTheme() + const handleClick = (event) => { setAnchorEl(event.currentTarget) @@ -144,6 +182,12 @@ export function Header() { const handleCloseSignUp = () => { setOpenSignUp(false) } + + const handleDrowDown = () => { + setresDrowp(!resDrowp) + } + + return ( <> {/* Display logo */} @@ -164,21 +208,22 @@ export function Header() { {/* Display relative link to other pages */} - - - {/* Display login option or user menu as per authenticated status */} + :
} { - (!auth.isAuthenticated ? ( + useMediaQuery(theme.breakpoints.up("sm")) ? <> - - - - - - - + - - - - - - - - - - - - ) - : (<> - - - - {(auth && auth.user) ? auth.user.name.charAt(0).toUpperCase() : (wait...)} - - - - - - - {/* */} + + + Members + + + + Contact us + + + + Dashboard + + ) + : (<> + + Home + + + + Help + + + ) + ) + } + + + {/* Display login option or user menu as per authenticated status */} + { + (!auth.isAuthenticated ? ( + <> + + + + + + + + + + + + + + + + + + + + + + + ) + : (<> + + + + {(auth && auth.user) ? auth.user.name.charAt(0).toUpperCase() : (wait...)} + + + + + + + {/* My Profile */} - - Dashboard - - { - dispatch(logout(history)) - }}> - Logout - - + + Dashboard + + { + dispatch(logout(history)) + }}> + Logout + + + + ) + ) + } + : + <> + + + - ) - ) } + ) } - export default function Navbar() { const classes = useStyles() - return ( -