import { useCallback } from 'react';
import { useRecoilState } from 'recoil';
import { sideDrawerState } from "../../../atoms/election/index.js";
const useSideDrawerState = function useSideDrawerState() {
  const [state, setState] = useRecoilState(sideDrawerState);
  const toggle = useCallback(() => {
    setState(old => old === 'open' ? 'closed' : 'open');
  }, []);
  const close = useCallback(() => {
    setState('closed');
  }, []);
  const open = useCallback(() => {
    setState('open');
  }, []);
  return {
    state,
    toggle,
    close,
    open
  };
};
export default useSideDrawerState;