Files
twenty_crm/front/src/modules/ui/right-drawer/components/RightDrawerTopBarExpandButton.tsx
2023-07-20 00:00:50 +02:00

32 lines
814 B
TypeScript

import {
IconLayoutSidebarRightCollapse,
IconLayoutSidebarRightExpand,
} from '@tabler/icons-react';
import { useRecoilState } from 'recoil';
import { IconButton } from '../../button/components/IconButton';
import { isRightDrawerExpandedState } from '../states/isRightDrawerExpandedState';
export function RightDrawerTopBarExpandButton() {
const [isRightDrawerExpanded, setIsRightDrawerExpanded] = useRecoilState(
isRightDrawerExpandedState,
);
function handleButtonClick() {
setIsRightDrawerExpanded(!isRightDrawerExpanded);
}
return (
<IconButton
icon={
isRightDrawerExpanded ? (
<IconLayoutSidebarRightCollapse size={16} />
) : (
<IconLayoutSidebarRightExpand size={16} />
)
}
onClick={handleButtonClick}
/>
);
}