import PressureDarkIcon from "assets/components/pressureDark.png";
import PressureLightIcon from "assets/components/pressureLight.png";
import { ImgIcon } from "common/ImgIcon";
import { useThemeType } from "hooks";
import React from "react";

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

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

  const lightIcon = () => {
    return PressureLightIcon;
  };

  const darkIcon = () => {
    return PressureDarkIcon;
  };

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

    return themeType === "light" ? darkIcon() : lightIcon();
  };

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

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