Bladeren bron

created mainContainer component and added responsive navbar

feature/1371_homepage_and_navigation
meris.ahmatovic 3 jaren geleden
bovenliggende
commit
0aa4e482c8

+ 16
- 16
src/App.js Bestand weergeven

import React from 'react';
import { Router } from 'react-router-dom';
import { Helmet } from 'react-helmet-async';
import i18next from 'i18next';
import history from './store/utils/history';
import AppRoutes from './AppRoutes';

const App = () => (
import React from "react";
import { Router } from "react-router-dom";
import { Helmet } from "react-helmet-async";
import i18next from "i18next";
import history from "./store/utils/history";
import MainContainer from "./components/Section/MainContainer";
import AppRoutes from "./AppRoutes";
const App = () => {
// const { pathname } = useLocation();
return (
<> <>
<Router history={history}> <Router history={history}>
<Helmet> <Helmet>
<title>
{i18next.t('app.title')}
</title>
<title>{i18next.t("app.title")}</title>
</Helmet> </Helmet>
<main className="l-page">
<AppRoutes />
</main>
<MainContainer>
<AppRoutes />
</MainContainer>
</Router> </Router>

</> </>
); );
};


export default App;
export default App;

BIN
src/assets/images/Avatar.png Bestand weergeven


BIN
src/assets/images/HR.png Bestand weergeven


BIN
src/assets/images/x.png Bestand weergeven


+ 8
- 0
src/assets/styles/_typography.scss Bestand weergeven



.text-black{ .text-black{
color: $mainBlack; color: $mainBlack;
}

.text-blue{
color: $mainBlue;
}

.text-grey9d{
color: $grey-9D;
} }

+ 4
- 0
src/assets/styles/_variables.scss Bestand weergeven

$mainBlack: #272727; $mainBlack: #272727;
$grayFD: #FDFDFD; $grayFD: #FDFDFD;


// heights from figma
$navHeight: 81px;

// Colors // Colors
$color-primary: #024f86; $color-primary: #024f86;
$color-primary-light: #024f86; $color-primary-light: #024f86;
$grey-7: rgba(128, 130, 133, 0.5); $grey-7: rgba(128, 130, 133, 0.5);
$grey-8: rgba(201, 214, 219, 0.25); $grey-8: rgba(201, 214, 219, 0.25);
$grey-9: #ebeff2; $grey-9: #ebeff2;
$grey-9D: #9d9d9d;
$grey-10: #f0f5f6; $grey-10: #f0f5f6;
$grey-11: #8b8b8b; $grey-11: #8b8b8b;
$grey-12: #b0bfc540; $grey-12: #b0bfc540;

+ 1
- 0
src/assets/styles/components/_nav.scss Bestand weergeven

// smooth transition from app-bg color to navbar bg-color // smooth transition from app-bg color to navbar bg-color
.navLinks-cont{ .navLinks-cont{
background: linear-gradient(90deg, rgba(255,255,255,0.25) 15%, white); background: linear-gradient(90deg, rgba(255,255,255,0.25) 15%, white);
height: $navHeight,
} }


.search-Icon{ .search-Icon{

+ 98
- 42
src/components/MUI/NavbarComponent.js Bestand weergeven

import React, { useState, useMemo, useContext } from "react";
import React, { useState, useMemo } from "react";
import { import {
AppBar, AppBar,
// Badge, // Badge,
Toolbar, Toolbar,
Typography, Typography,
List, List,
ListItem,
// ListItem,
ListItemButton, ListItemButton,
ListItemIcon, ListItemIcon,
ListItemText, ListItemText,
useMediaQuery, useMediaQuery,
Button,
} from "@mui/material"; } from "@mui/material";
import HrLogo from "../../assets/images/hrcenter.png";
import HrLogo from "../../assets/images/HR.png";
// import x from "../../assets/images/x.png";
import avatarLogo from "../../assets/images/Avatar.png";
import searchIcon from "../../assets/images/Vector.png"; import searchIcon from "../../assets/images/Vector.png";
import { useTheme } from "@mui/system"; import { useTheme } from "@mui/system";
import MenuOutlinedIcon from "@mui/icons-material/MenuOutlined"; import MenuOutlinedIcon from "@mui/icons-material/MenuOutlined";
// import ShoppingBasketIcon from "@mui/icons-material/ShoppingBasket"; // import ShoppingBasketIcon from "@mui/icons-material/ShoppingBasket";
import Brightness4Icon from "@mui/icons-material/Brightness4";
import Brightness7Icon from "@mui/icons-material/Brightness7";
// import Brightness4Icon from "@mui/icons-material/Brightness4";
// import Brightness7Icon from "@mui/icons-material/Brightness7";
// import MenuList from "./MenuListComponent"; // import MenuList from "./MenuListComponent";
import Drawer from "./DrawerComponent"; import Drawer from "./DrawerComponent";
import { ColorModeContext } from "../../context/ColorModeContext";
// import { ColorModeContext } from "../../context/ColorModeContext";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import CloseIcon from "@mui/icons-material/Close";
import LogoutIcon from "@mui/icons-material/Logout";


const NavbarComponent = () => { const NavbarComponent = () => {
const navItems = [ const navItems = [
const [openDrawer, setOpenDrawer] = useState(false); const [openDrawer, setOpenDrawer] = useState(false);
const theme = useTheme(); const theme = useTheme();
const matches = useMediaQuery(theme.breakpoints.down("sm")); const matches = useMediaQuery(theme.breakpoints.down("sm"));
const toggleColorMode = useContext(ColorModeContext);
// const toggleColorMode = useContext(ColorModeContext);


const { t } = useTranslation(); const { t } = useTranslation();




const drawerContent = useMemo( const drawerContent = useMemo(
() => ( () => (
<List>
{navItems.map((n) => (
<ListItemButton key={n} divider onClick={handleToggleDrawer}>
<ListItemIcon>
<ListItemText
variant="body1"
sx={{
marginRight: "50px",
cursor: "pointer",
textAlign: "right",
lineHeight: "20.11px",
fontWeight: "400",
color: "text.primary",
marginY: "0",
padding: "0",
}}
className="text-black"
>
{t("nav." + n)}
</ListItemText>
</ListItemIcon>
</ListItemButton>
))}
<ListItem divider>
<IconButton onClick={toggleColorMode}>
<ListItemText>Toggle {theme.palette.mode} mode</ListItemText>
{theme.palette.mode === "dark" ? (
<Brightness7Icon />
) : (
<Brightness4Icon />
)}
<div style={{ width: "100vw", padding: "36px" }}>
<div
className="flex-center"
style={{ justifyContent: "space-between", marginBottom: "20px" }}
>
<Typography
sx={{ fontWeight: 600, fontSize: "18px", letterSpacing: "1.5px" }}
>
Navigacija
</Typography>
{/* <img src={x}/> */}
<IconButton onClick={handleToggleDrawer}>
<CloseIcon />
</IconButton> </IconButton>
</ListItem>
</List>
</div>
<div className="flex-center flex-col">
<img src={avatarLogo} width="64px" height="64px" />
<Typography
variant="h5"
sx={{ fontSize: "18px", marginTop: "15px", }}
className="text-blue"
>
Danijela Ranđelović
</Typography>
<Typography
variant="body1"
sx={{ fontSize: "14px", marginTop: "8px" }}
className="text-grey9d"
>
HR Specialist
</Typography>
<div className="hr" style={{ width: "90%", marginTop: "18px" }}></div>
</div>
<List>
{navItems.map((n) => (
<ListItemButton key={n} onClick={handleToggleDrawer}>
<ListItemIcon>
<ListItemText
variant="body1"
sx={{
// marginRight: "50px",
cursor: "pointer",
textAlign: "left",
lineHeight: "17.6px",
fontWeight: "400",
color: "#353535",
marginY: "0",
padding: "0",
}}
className="text-black"
>
{t("nav." + n)}
</ListItemText>
</ListItemIcon>
</ListItemButton>
))}
{/* <ListItem divider>
<IconButton onClick={toggleColorMode}>
<ListItemText>Toggle {theme.palette.mode} mode</ListItemText>
{theme.palette.mode === "dark" ? (
<Brightness7Icon />
) : (
<Brightness4Icon />
)}
</IconButton>
</ListItem> */}
</List>
{/* <button style={{width:'90%', margin: 'auto'}} className="flex-center"> */}
{/* <Typography>s</Typography> */}
<div className="flex-center">
<Button
sx={{
padding: "18px 72px",
border: "1px solid #226cb0",
borderRadius: "9px",
background: "white",
width: "90%",
marginTop: '50px'
}}
startIcon={<LogoutIcon />}
>
{t("nav.signOut")}
</Button>
</div>
</div>
), ),
[handleToggleDrawer] [handleToggleDrawer]
); );
> >
{matches ? ( {matches ? (
<Box> <Box>
<IconButton onClick={handleToggleDrawer}>
<IconButton sx={{marginLeft: '15px'}} onClick={handleToggleDrawer}>
<MenuOutlinedIcon /> <MenuOutlinedIcon />
</IconButton> </IconButton>
</Box> </Box>
alignItems: "center", alignItems: "center",
paddingRight: "20px", paddingRight: "20px",
justifyContent: "flex-end", justifyContent: "flex-end",
height: "81px",
// HEIGHT OF THE NAVBAR IN md & xl SIZE
width: "1076px", width: "1076px",
borderBottom: "1px solid #F4F4F4", borderBottom: "1px solid #F4F4F4",
boxSizing: "border-box", boxSizing: "border-box",

+ 26
- 0
src/components/Section/MainContainer.js Bestand weergeven

import React from "react";
import PropType from "prop-types";
import { useLocation } from "react-router-dom";
import Navbar from "../../components/MUI/NavbarComponent";
// import AppRoutes from "../../AppRoutes";

const MainContainer = ({ children }) => {
const { pathname } = useLocation();

return pathname !== "/" ? (
<div className="">
<Navbar />
<div className="h-withHeader">
{children}
</div>
</div>
) : (
<div className="">{children}</div>
);
};

MainContainer.propTypes = {
children: PropType.any,
};

export default MainContainer;

+ 11
- 0
src/main.scss Bestand weergeven

.flex-center{ .flex-center{
@include flex-center; @include flex-center;
} }
.flex-col{
flex-direction: column !important;
}
.fullwidth{
width: 100% !important;
}
.h-withHeader{
height: calc(100vh - $navHeight);
// remove css line below, just for showcase
background-color: $mainBlue;
}


// ================= mui overrides // ================= mui overrides
.css-122f4x8-MuiToolbar-root { .css-122f4x8-MuiToolbar-root {

+ 2
- 2
src/pages/HomePage/HomePageMUI.js Bestand weergeven

import React from "react"; import React from "react";
// import { Box, Grid } from '@mui/material'; // import { Box, Grid } from '@mui/material';
import Navbar from "../../components/MUI/NavbarComponent";
// import Navbar from "../../components/MUI/NavbarComponent";
// import Modals from '../../components/MUI/Examples/ModalsExample'; // import Modals from '../../components/MUI/Examples/ModalsExample';
// import DataGrid from '../../components/MUI/Examples/DataGridExample'; // import DataGrid from '../../components/MUI/Examples/DataGridExample';
// import PagingSortingFiltering from '../../components/MUI/Examples/PagingSortingFilteringExample'; // import PagingSortingFiltering from '../../components/MUI/Examples/PagingSortingFilteringExample';
const HomePage = () => { const HomePage = () => {
return ( return (
<div> <div>
<Navbar />
{/* <Navbar /> */}
<div className="l-t-rectangle"></div> <div className="l-t-rectangle"></div>
<div className="r-b-rectangle"></div> <div className="r-b-rectangle"></div>
{/* <Box sx={{ mt: 4, mx: 4 }}> {/* <Box sx={{ mt: 4, mx: 4 }}>

+ 5
- 4
src/pages/LoginPage/LoginPageMUI.js Bestand weergeven

/* eslint-disable */ /* eslint-disable */
import React, { useState } from "react";
import React, { useEffect, useState } from "react";
import PropTypes from "prop-types"; import PropTypes from "prop-types";
import { useFormik } from "formik"; import { useFormik } from "formik";
import { useDispatch, useSelector } from "react-redux"; import { useDispatch, useSelector } from "react-redux";
// When user refreshes page // When user refreshes page
// useEffect(() => { // useEffect(() => {
// function redirectClient() { // function redirectClient() {
// if (!tokens.RefreshToken && !tokens.JwtToken) {
// let token = localStorage.getItem("JwtToken")
// if (!token) {
// return; // return;
// } // }
// handleApiResponseSuccess()
// } // }

// redirectClient(); // redirectClient();
// }, [history, tokens]);
// }, [history]);


const isLoading = useSelector( const isLoading = useSelector(
selectIsLoadingByActionType(LOGIN_USER_LOADING) selectIsLoadingByActionType(LOGIN_USER_LOADING)

Laden…
Annuleren
Opslaan