import { ComprehensiveProps } from "../../DomainProps";
import IconWidgetView from "./IconWidgetView";

interface IconTextProps extends ComprehensiveProps {
  fillMode: "link" | "clear" | "flat" | "outline";
  title: string;
}

const IconWidget = (props: IconTextProps) => {
  const handleOnClick = (event: any) => {
    if (props.onClick) props.onClick(null, props.screenDataField, event);
  };
  return (
    <section
      id={props.rootStyle?.id}
      className={props.rootStyle?.className}
      style={props.rootStyle?.inline}
      title={props.title}
    >
      <IconWidgetView
        widgetStyle={props.widgetStyle}
        name={props.name}
        fillMode={props.fillMode}
        onClick={handleOnClick}
      />
    </section>
  );
};

export default IconWidget;
