Portal/rsconcept/frontend/src/app/Navigation/ToggleNavigationButton.tsx

35 lines
1.1 KiB
TypeScript
Raw Normal View History

2024-06-07 20:17:03 +03:00
import clsx from 'clsx';
import { motion } from 'framer-motion';
import { IconPin, IconUnpin } from '@/components/Icons';
import { useConceptOptions } from '@/context/OptionsContext';
import { animateNavigationToggle } from '@/styling/animations';
import { globals } from '@/utils/constants';
function ToggleNavigationButton() {
const { noNavigationAnimation, toggleNoNavigation } = useConceptOptions();
return (
<motion.button
type='button'
tabIndex={-1}
className={clsx(
'absolute top-0 right-0 z-navigation flex items-center justify-center',
2024-06-21 11:16:47 +03:00
'clr-hover',
'select-none',
'min-h-[2rem]'
2024-06-07 20:17:03 +03:00
)}
onClick={toggleNoNavigation}
initial={false}
animate={noNavigationAnimation ? 'off' : 'on'}
variants={animateNavigationToggle}
data-tooltip-id={globals.tooltip}
data-tooltip-content={noNavigationAnimation ? 'Показать навигацию' : 'Скрыть навигацию'}
>
{!noNavigationAnimation ? <IconPin /> : null}
{noNavigationAnimation ? <IconUnpin /> : null}
</motion.button>
);
}
export default ToggleNavigationButton;