import { useCallback } from 'react';
import getColor from "../../../utils/colors/getColor.js";
import getElectionPaletteColor from "../../../utils/colors/getElectionPaletteColor.js";
const useGetCountyProps = function useGetCountyProps(colors) {
  return useCallback(({
    code
  }) => {
    const color = colors.fipsToPalette.get(code);
    if (!color || color.status === 'unclear') {
      return {
        fill: 'white',
        stroke: getColor('warmgray-100')
      };
    }
    if (color.status === 'leader') {
      return {
        fill: `url(#${color.palette}-leading)`,
        stroke: 'white'
      };
    }
    return {
      fill: getColor(getElectionPaletteColor(color.palette, 'main')),
      stroke: 'white'
    };
  }, [colors]);
};
export default useGetCountyProps;