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