import { useState, useEffect } from "react";
import withHelperText from "../../../hoc/withHelperText";
import withLabel from "../../../hoc/withLabel";
import GaugeWidget, { GaugeProps } from "./GaugeWidget";

const GaugeContainer = (props: GaugeProps) => {
  const [gaugeProps, setGaugeProps] = useState<GaugeProps>({} as GaugeProps);
  
  useEffect(() => {
    setGaugeProps({ ...props });
  }, [props]);
  
  return <GaugeWidget {...gaugeProps} />;
};

export default withHelperText(withLabel(GaugeContainer));
