import DeviceGroupLightIcon from "assets/products/Construction/deviceGroupIconLight.png";
import DeviceGroupDarkIcon from "assets/products/Construction/deviceGroupIconDark.png";
import { ImgIcon } from "common/ImgIcon";
import { useThemeType } from "hooks";
import React from "react";

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

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

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

    return themeType === "light" ? DeviceGroupDarkIcon : DeviceGroupLightIcon;
  };

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

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