mirror of
https://github.com/hazemKrimi/crimson-quirks-ui.git
synced 2026-05-01 18:20:28 +00:00
Update navbar component
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import { useReactiveVar } from '@apollo/client';
|
import { useReactiveVar } from '@apollo/client';
|
||||||
import { useHistory } from 'react-router';
|
import { useHistory, useLocation } from 'react-router';
|
||||||
import { roleVar, tokenVar, userVar } from '../../graphql/state';
|
import { roleVar, tokenVar, userVar } from '../../graphql/state';
|
||||||
import { Wrapper } from './styles';
|
import { Wrapper } from './styles';
|
||||||
import { Avatar, Link, Menu, Text } from '..';
|
import { Avatar, Link, Menu, Text } from '..';
|
||||||
@@ -9,12 +9,42 @@ const Navbar = () => {
|
|||||||
const user = useReactiveVar(userVar);
|
const user = useReactiveVar(userVar);
|
||||||
const role = useReactiveVar(roleVar);
|
const role = useReactiveVar(roleVar);
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
|
const location = useLocation();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Wrapper color={role}>
|
<Wrapper color={role}>
|
||||||
<Link href='/'>
|
<Link href='/'>
|
||||||
<Logo />
|
<Logo />
|
||||||
</Link>
|
</Link>
|
||||||
|
<nav>
|
||||||
|
{role === 'admin' && (
|
||||||
|
<>
|
||||||
|
<Link
|
||||||
|
href='/clients'
|
||||||
|
color={location.pathname === '/clients' ? 'admin' : 'black'}
|
||||||
|
selected={location.pathname === '/clients'}
|
||||||
|
>
|
||||||
|
Clients
|
||||||
|
</Link>
|
||||||
|
<Link
|
||||||
|
href='/product-owners'
|
||||||
|
color={
|
||||||
|
location.pathname === '/product-owners' ? 'admin' : 'black'
|
||||||
|
}
|
||||||
|
selected={location.pathname === '/product-owners'}
|
||||||
|
>
|
||||||
|
Product Owners
|
||||||
|
</Link>
|
||||||
|
<Link
|
||||||
|
href='/developers'
|
||||||
|
color={location.pathname === '/developers' ? 'admin' : 'black'}
|
||||||
|
selected={location.pathname === '/developers'}
|
||||||
|
>
|
||||||
|
Developers
|
||||||
|
</Link>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
</nav>
|
||||||
<div className='menu'></div>
|
<div className='menu'></div>
|
||||||
<div className='user' id='user'>
|
<div className='user' id='user'>
|
||||||
<Avatar
|
<Avatar
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ type WrapperProps = {
|
|||||||
export const Wrapper = styled.div<WrapperProps>`
|
export const Wrapper = styled.div<WrapperProps>`
|
||||||
background: ${({ theme }) => theme.colors.white.main};
|
background: ${({ theme }) => theme.colors.white.main};
|
||||||
box-shadow: 0px 1px 10px rgba(0, 0, 0, 0.25);
|
box-shadow: 0px 1px 10px rgba(0, 0, 0, 0.25);
|
||||||
display: grid;
|
display: flex;
|
||||||
grid-template-columns: auto 1fr auto;
|
flex-direction: row;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding: 15px 45px 15px 120px;
|
padding: 15px 45px 15px 120px;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
@@ -26,6 +26,15 @@ export const Wrapper = styled.div<WrapperProps>`
|
|||||||
color ? theme.colors[color].main : theme.colors.client.main};
|
color ? theme.colors[color].main : theme.colors.client.main};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nav {
|
||||||
|
flex-grow: 1;
|
||||||
|
margin-left: 60px;
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(3, auto);
|
||||||
|
column-gap: 20px;
|
||||||
|
justify-content: flex-start;
|
||||||
|
}
|
||||||
|
|
||||||
.user {
|
.user {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
|
|||||||
Reference in New Issue
Block a user