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

32 lines
1.0 KiB
TypeScript
Raw Normal View History

import clsx from 'clsx';
import { motion } from 'framer-motion';
2023-12-08 19:24:08 +03:00
import { IconPin, IconUnpin } from '@/components/Icons';
2024-04-01 19:07:20 +03:00
import { useConceptOptions } from '@/context/OptionsContext';
import { animateNavigationToggle } from '@/styling/animations';
2023-12-08 19:24:08 +03:00
function ToggleNavigationButton() {
2024-04-01 19:07:20 +03:00
const { noNavigationAnimation, toggleNoNavigation } = useConceptOptions();
2023-12-08 19:24:08 +03:00
return (
2023-12-28 14:04:44 +03:00
<motion.button
type='button'
tabIndex={-1}
title={noNavigationAnimation ? 'Показать навигацию' : 'Скрыть навигацию'}
className={clsx(
'absolute top-0 right-0 z-navigation flex items-center justify-center',
'clr-btn-nav',
'select-none disabled:cursor-not-allowed'
)}
onClick={toggleNoNavigation}
initial={false}
animate={noNavigationAnimation ? 'off' : 'on'}
variants={animateNavigationToggle}
>
{!noNavigationAnimation ? <IconPin /> : null}
{noNavigationAnimation ? <IconUnpin /> : null}
2023-12-28 14:04:44 +03:00
</motion.button>
);
}
2023-12-28 14:04:44 +03:00
export default ToggleNavigationButton;