2019-06-26 04:28:56 +00:00
|
|
|
import * as React from 'react';
|
|
|
|
import { Link, NavLink } from 'react-router-dom';
|
|
|
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
2020-07-03 21:50:37 +00:00
|
|
|
import { faCogs, faLayerGroup, faSignOutAlt, faUserCircle } from '@fortawesome/free-solid-svg-icons';
|
2019-11-16 21:08:38 +00:00
|
|
|
import { useStoreState } from 'easy-peasy';
|
|
|
|
import { ApplicationStore } from '@/state';
|
2020-04-04 05:39:53 +00:00
|
|
|
import SearchContainer from '@/components/dashboard/search/SearchContainer';
|
2020-12-26 18:41:25 +00:00
|
|
|
import tw, { theme } from 'twin.macro';
|
2020-07-03 21:50:37 +00:00
|
|
|
import styled from 'styled-components/macro';
|
|
|
|
|
|
|
|
const Navigation = styled.div`
|
2020-09-13 17:02:25 +00:00
|
|
|
${tw`w-full bg-neutral-900 shadow-md overflow-x-auto`};
|
2020-08-22 22:49:18 +00:00
|
|
|
|
2020-07-03 21:50:37 +00:00
|
|
|
& > div {
|
|
|
|
${tw`mx-auto w-full flex items-center`};
|
|
|
|
}
|
2020-08-22 22:49:18 +00:00
|
|
|
|
2020-07-03 21:50:37 +00:00
|
|
|
& #logo {
|
|
|
|
${tw`flex-1`};
|
2020-08-22 22:49:18 +00:00
|
|
|
|
2020-07-03 21:50:37 +00:00
|
|
|
& > a {
|
|
|
|
${tw`text-2xl font-header px-4 no-underline text-neutral-200 hover:text-neutral-100 transition-colors duration-150`};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
|
|
|
const RightNavigation = styled.div`
|
|
|
|
${tw`flex h-full items-center justify-center`};
|
2020-08-22 22:49:18 +00:00
|
|
|
|
2020-07-03 21:50:37 +00:00
|
|
|
& > a, & > .navigation-link {
|
|
|
|
${tw`flex items-center h-full no-underline text-neutral-300 px-6 cursor-pointer transition-all duration-150`};
|
2020-08-22 22:49:18 +00:00
|
|
|
|
2020-07-03 21:50:37 +00:00
|
|
|
&:active, &:hover {
|
|
|
|
${tw`text-neutral-100 bg-black`};
|
|
|
|
}
|
2020-08-22 22:49:18 +00:00
|
|
|
|
2020-07-03 21:50:37 +00:00
|
|
|
&:active, &:hover, &.active {
|
2020-12-26 18:41:25 +00:00
|
|
|
box-shadow: inset 0 -2px ${theme`colors.cyan.700`.toString()};
|
2020-07-03 21:50:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
`;
|
2019-06-26 04:28:56 +00:00
|
|
|
|
2019-11-16 21:08:38 +00:00
|
|
|
export default () => {
|
2019-12-16 02:07:16 +00:00
|
|
|
const name = useStoreState((state: ApplicationStore) => state.settings.data!.name);
|
2020-08-26 04:39:00 +00:00
|
|
|
const rootAdmin = useStoreState((state: ApplicationStore) => state.user.data!.rootAdmin);
|
2019-11-16 21:08:38 +00:00
|
|
|
|
|
|
|
return (
|
2020-07-03 21:50:37 +00:00
|
|
|
<Navigation>
|
|
|
|
<div css={tw`mx-auto w-full flex items-center`} style={{ maxWidth: '1200px', height: '3.5rem' }}>
|
2019-11-16 21:08:38 +00:00
|
|
|
<div id={'logo'}>
|
|
|
|
<Link to={'/'}>
|
2019-12-16 02:07:16 +00:00
|
|
|
{name}
|
2019-11-16 21:08:38 +00:00
|
|
|
</Link>
|
|
|
|
</div>
|
2020-08-22 22:49:18 +00:00
|
|
|
|
2020-07-03 21:50:37 +00:00
|
|
|
<RightNavigation>
|
2020-04-04 05:39:53 +00:00
|
|
|
<SearchContainer/>
|
2020-07-03 21:50:37 +00:00
|
|
|
<NavLink to={'/'} exact>
|
2019-11-16 21:08:38 +00:00
|
|
|
<FontAwesomeIcon icon={faLayerGroup}/>
|
|
|
|
</NavLink>
|
|
|
|
<NavLink to={'/account'}>
|
|
|
|
<FontAwesomeIcon icon={faUserCircle}/>
|
|
|
|
</NavLink>
|
2020-08-22 22:49:18 +00:00
|
|
|
|
2020-08-26 04:39:00 +00:00
|
|
|
{rootAdmin &&
|
2020-08-22 22:49:18 +00:00
|
|
|
<a href={'/admin'}>
|
2019-11-16 21:08:38 +00:00
|
|
|
<FontAwesomeIcon icon={faCogs}/>
|
|
|
|
</a>
|
|
|
|
}
|
2020-08-22 22:49:18 +00:00
|
|
|
|
2019-12-16 02:07:45 +00:00
|
|
|
<a href={'/auth/logout'}>
|
2019-11-16 21:08:38 +00:00
|
|
|
<FontAwesomeIcon icon={faSignOutAlt}/>
|
2019-12-16 02:07:45 +00:00
|
|
|
</a>
|
2020-07-03 21:50:37 +00:00
|
|
|
</RightNavigation>
|
2019-06-26 04:28:56 +00:00
|
|
|
</div>
|
2020-07-03 21:50:37 +00:00
|
|
|
</Navigation>
|
2019-11-16 21:08:38 +00:00
|
|
|
);
|
|
|
|
};
|