ConceptPortal-public/rsconcept/frontend/src/components/Navigation/Navigation.tsx

62 lines
2.1 KiB
TypeScript
Raw Normal View History

2023-07-15 17:46:19 +03:00
import { useNavigate } from 'react-router-dom';
2023-07-25 20:27:29 +03:00
import { useConceptTheme } from '../../context/ThemeContext';
2023-07-15 17:46:19 +03:00
import { EducationIcon, LibraryIcon } from '../Icons';
2023-07-25 20:27:29 +03:00
import Logo from './Logo'
2023-07-15 17:46:19 +03:00
import NavigationButton from './NavigationButton';
import UserMenu from './UserMenu';
2023-07-25 20:27:29 +03:00
function Navigation () {
2023-07-15 17:46:19 +03:00
const navigate = useNavigate();
const { noNavigation, toggleNoNavigation } = useConceptTheme();
2023-07-15 17:46:19 +03:00
2023-07-28 00:10:26 +03:00
const navigateCommon = () => { navigate('/library?filter=common') };
2023-07-25 20:27:29 +03:00
const navigateHelp = () => { navigate('/manuals') };
2023-07-15 17:46:19 +03:00
return (
2023-08-26 19:39:49 +03:00
<nav className='sticky top-0 left-0 right-0 z-50 select-none h-fit'>
2023-07-25 20:27:29 +03:00
{!noNavigation &&
<button
title='Скрыть навигацию'
2023-08-26 19:39:49 +03:00
className='absolute top-0 right-0 z-[60] w-[1.2rem] border-b-2 border-l-2 clr-nav rounded-none'
onClick={toggleNoNavigation}
>
<p>{'>'}</p><p>{'>'}</p>
</button>}
2023-07-25 20:27:29 +03:00
{noNavigation &&
<button
title='Показать навигацию'
2023-08-26 19:39:49 +03:00
className='absolute top-0 right-0 z-[60] px-1 h-[1.6rem] border-b-2 border-l-2 clr-nav rounded-none'
onClick={toggleNoNavigation}
>
{''}
</button>}
2023-07-25 20:27:29 +03:00
{!noNavigation &&
2023-08-26 19:39:49 +03:00
<div className='flex items-center justify-between py-1 pl-2 pr-6 border-b-2 rounded-none clr-nav'>
<div className='flex items-center justify-start'>
2023-07-15 17:46:19 +03:00
<Logo title='КонцептПортал' />
</div>
<div className='flex items-center'>
<div className='flex items-center pl-2'>
2023-08-26 19:39:49 +03:00
<NavigationButton
text='Библиотека'
description='Библиотека концептуальных схем'
icon={<LibraryIcon />}
onClick={navigateCommon}
/>
<NavigationButton
text='Справка'
description='Справочные материалы и обучение'
icon={<EducationIcon />}
onClick={navigateHelp}
/>
2023-07-15 17:46:19 +03:00
<UserMenu />
</div>
</div>
</div>}
2023-07-15 17:46:19 +03:00
</nav>
);
}
export default Navigation;