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

36 lines
877 B
TypeScript
Raw Normal View History

import clsx from 'clsx';
2023-12-08 19:24:08 +03:00
import { useMemo } from 'react';
import { useConceptTheme } from '@/context/ThemeContext';
2023-12-08 19:24:08 +03:00
function ToggleNavigationButton() {
const { noNavigation, toggleNoNavigation } = useConceptTheme();
const text = useMemo(() => (
noNavigation ?
''
:
<>
<p>{'>'}</p>
<p>{'>'}</p>
</>
), [noNavigation]
2023-12-08 19:24:08 +03:00
);
return (
<button type='button' tabIndex={-1}
title={noNavigation ? 'Показать навигацию' : 'Скрыть навигацию'}
className={clsx(
'absolute top-0 right-0 z-navigation',
'border-b-2 border-l-2 rounded-none',
'clr-btn-nav',
{
'px-1 h-[1.6rem]': noNavigation,
'w-[1.2rem] h-[3rem]': !noNavigation
}
)}
2023-12-08 19:24:08 +03:00
onClick={toggleNoNavigation}
>
{text}
</button>);
}
export default ToggleNavigationButton;