import { useCallback } from 'react';

import { useColorMode } from '@chakra-ui/react';

export const useThemeMode = () => {
  const { colorMode, toggleColorMode, setColorMode } = useColorMode();

  const mode = useCallback(
    (lightValue, darkValue) => (colorMode === 'dark' ? darkValue : lightValue),
    [colorMode]
  );

  return {
    toggleColorMode,
    setColorMode,
    mode,
    colorMode,
  };
};
