ConceptPortal-public/rsconcept/frontend/src/components/Navigation/Navigation.tsx
2023-11-24 18:03:10 +03:00

68 lines
2.4 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { useConceptNavigation } from '../../context/NagivationContext';
import { useConceptTheme } from '../../context/ThemeContext';
import { EducationIcon, LibraryIcon, PlusIcon } from '../Icons';
import Logo from './Logo'
import NavigationButton from './NavigationButton';
import UserMenu from './UserMenu';
function Navigation () {
const { navigateTo } = useConceptNavigation();
const { noNavigation, toggleNoNavigation } = useConceptTheme();
const navigateLibrary = () => navigateTo('/library');
const navigateHelp = () => navigateTo('/manuals');
const navigateCreateNew = () => navigateTo('/rsform-create');
return (
<nav className='sticky top-0 left-0 right-0 select-none clr-app z-navigation h-fit'>
{!noNavigation &&
<button
title='Скрыть навигацию'
className='absolute top-0 right-0 z-navigation w-[1.2rem] h-[3rem] border-b-2 border-l-2 clr-btn-nav rounded-none'
onClick={toggleNoNavigation}
tabIndex={-1}
>
<p>{'>'}</p><p>{'>'}</p>
</button>}
{noNavigation &&
<button
title='Показать навигацию'
className='absolute top-0 right-0 z-navigation px-1 h-[1.6rem] border-b-2 border-l-2 clr-btn-nav rounded-none'
onClick={toggleNoNavigation}
tabIndex={-1}
>
{''}
</button>}
{!noNavigation &&
<div className='flex items-stretch justify-between pl-2 pr-[0.8rem] border-b-2 rounded-none h-[3rem]'>
<div className='flex items-center justify-start'>
<Logo />
</div>
<div className='flex items-center h-full'>
<NavigationButton
text='Новая схема'
description='Создать новую схему'
icon={<PlusIcon />}
onClick={navigateCreateNew}
/>
<NavigationButton
text='Библиотека'
description='Библиотека концептуальных схем'
icon={<LibraryIcon />}
onClick={navigateLibrary}
/>
<NavigationButton
text='Справка'
description='Справочные материалы и обучение'
icon={<EducationIcon />}
onClick={navigateHelp}
/>
<UserMenu />
</div>
</div>}
</nav>
);
}
export default Navigation;