Files
twenty/packages/twenty-front/src/modules/ui/layout/right-drawer/components/RightDrawerTopBarExpandButton.tsx
2023-12-10 18:10:54 +01:00

33 lines
833 B
TypeScript

import { useRecoilState } from 'recoil';
import {
IconLayoutSidebarRightCollapse,
IconLayoutSidebarRightExpand,
} from '@/ui/display/icon';
import { LightIconButton } from '@/ui/input/button/components/LightIconButton';
import { isRightDrawerExpandedState } from '../states/isRightDrawerExpandedState';
export const RightDrawerTopBarExpandButton = () => {
const [isRightDrawerExpanded, setIsRightDrawerExpanded] = useRecoilState(
isRightDrawerExpandedState,
);
const handleButtonClick = () => {
setIsRightDrawerExpanded(!isRightDrawerExpanded);
};
return (
<LightIconButton
size="medium"
accent="tertiary"
Icon={
isRightDrawerExpanded
? IconLayoutSidebarRightCollapse
: IconLayoutSidebarRightExpand
}
onClick={handleButtonClick}
/>
);
};