import SitesDarkIcon from "assets/products/Construction/sitesIconDark.png";
import SitesLightIcon from "assets/products/Construction/sitesIconLight.png";
import { ImgIcon } from "common/ImgIcon";
import { useThemeType } from "hooks";
import React from "react";

interface Props {
  size?: number;
  type?: "light" | "dark";
}

export default function SitesIcon(props: Props) {
  const themeType = useThemeType();
  const { type, size } = props;

  const src = () => {
    if (type) {
      return type === "light" ? SitesLightIcon : SitesDarkIcon;
    }

    return themeType === "light" ? SitesDarkIcon : SitesLightIcon;
  };

  if (size) {
    return <img width={size} height={size} alt="bins" src={src()} />;
  }

  return <ImgIcon alt="sites" src={src()} />;
}
