import { BaseProps } from "../../DomainProps";

export interface LabelProps extends BaseProps {
  title: string | undefined;
  htmlFor?: string | undefined;
}

const LabelView = ({
  title,
  htmlFor,
  widgetStyle,
  id,
  onClick,
}: LabelProps) => {
  return title ? (
    <label
      htmlFor={htmlFor}
      id={widgetStyle?.id ?? ""}
      className={widgetStyle?.className ?? ""}
      style={widgetStyle?.inline ?? {}}
      onClick={(e) => onClick?.(null, "", e)}
    >
      <span id={htmlFor}>{title}</span>
    </label>
  ) : null;
};
export default LabelView;
