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

28 lines
1018 B
TypeScript
Raw Normal View History

import clsx from 'clsx';
import { motion } from 'framer-motion';
import { RiPushpinFill, RiUnpinLine } from 'react-icons/ri';
2023-12-08 19:24:08 +03:00
import { useConceptTheme } from '@/context/ThemeContext';
import { animateNavigationToggle } from '@/utils/animations';
2023-12-08 19:24:08 +03:00
function ToggleNavigationButton() {
const { noNavigationAnimation, toggleNoNavigation } = useConceptTheme();
2023-12-08 19:24:08 +03:00
return (
<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'
)}
2023-12-08 19:24:08 +03:00
onClick={toggleNoNavigation}
initial={false}
animate={noNavigationAnimation ? 'off' : 'on'}
variants={animateNavigationToggle}
2023-12-08 19:24:08 +03:00
>
{!noNavigationAnimation ? <RiPushpinFill /> : null}
{noNavigationAnimation ? <RiUnpinLine /> : null}
</motion.button>);
}
export default ToggleNavigationButton;