import React from "react";
import PropTypes from "prop-types";
import CheckCircleIcon from "@material-ui/icons/CheckCircle";
import CheckBoxIcon from "@material-ui/icons/CheckBox";
import { Tooltip } from "@material-ui/core";

const ConnectedIcon = (props) => {
  if (props.connected || props.connectedHMI) {
    return (
      <span style={props.style}>
        {props.connected && (
          <Tooltip title="TBOX">
            <CheckCircleIcon
              style={{ color: "Green", fontSize: 12, marginRight: 3 }}
            />
          </Tooltip>
        )}
        {props.connectedHMI && (
          <Tooltip title="ICC">
            <CheckBoxIcon
              style={{ color: "Blue", fontSize: 12, marginRight: 3 }}
            />
          </Tooltip>
        )}
      </span>
    );
  }

  return null;
};

ConnectedIcon.propTypes = {
  connected: PropTypes.bool.isRequired,
};

export default ConnectedIcon;
