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

53 lines
1.8 KiB
TypeScript
Raw Normal View History

import { useConceptNavigation } from '@/context/NagivationContext';
import { useConceptTheme } from '@/context/ThemeContext';
import { EducationIcon, LibraryIcon, PlusIcon } from '@/components/Icons';
import Logo from './Logo';
2023-07-15 17:46:19 +03:00
import NavigationButton from './NavigationButton';
import ToggleNavigationButton from './ToggleNavigationButton';
2023-07-15 17:46:19 +03:00
import UserMenu from './UserMenu';
2023-07-25 20:27:29 +03:00
function Navigation () {
const router = useConceptNavigation();
2023-12-08 19:24:08 +03:00
const { noNavigation } = useConceptTheme();
2023-07-15 17:46:19 +03:00
const navigateHome = () => router.push('/');
const navigateLibrary = () => router.push('/library');
const navigateHelp = () => router.push('/manuals');
const navigateCreateNew = () => router.push('/library/create');
2023-07-25 20:27:29 +03:00
2023-07-15 17:46:19 +03:00
return (
<nav className='sticky top-0 left-0 right-0 select-none clr-app z-navigation'>
2023-12-08 19:24:08 +03:00
<ToggleNavigationButton />
{!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 mr-2 cursor-pointer' onClick={navigateHome} tabIndex={-1}>
<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> : null}
</nav>);
2023-07-15 17:46:19 +03:00
}
export default Navigation;