import ContractIconLight from "assets/common/contractWhite.png";
import ContractIconDark from "assets/common/contractBlack.png";
import { ImgIcon } from "common/ImgIcon";
import { useThemeType } from "hooks";
import React from "react";

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

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

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

    return themeType === "light" ? ContractIconDark : ContractIconLight;
  };

  return size ? (
    <img alt="fields" height={size} width={size} src={src()} />
  ) : (
    <ImgIcon alt="fields" src={src()} />
  );
}
