import { useState, useEffect } from "react";
import withHelperText from "../../../hoc/withHelperText";
import withLabel from "../../../hoc/withLabel";
import withValidations from "../../../hoc/withValidations";
import ButtonDropdownWidget, {
  ButtonDropdownProps,
} from "./ButtonDropdownWidget";

const ButtonDropdownContainer = (props: ButtonDropdownProps) => {
  const [buttonDropdownProps, setButtonDropdownProps] = useState<ButtonDropdownProps>(
    {} as ButtonDropdownProps
  );
  useEffect(() => {
    setButtonDropdownProps({ ...props });
  }, [props]);
  return <ButtonDropdownWidget {...buttonDropdownProps} />;
};
export default withValidations(
  withHelperText(withLabel(ButtonDropdownContainer))
);
