import PropTypes from "prop-types";
import { FormControl } from "@material-ui/core";
import useStyles from "../../useStyles";

export const Parameters = (props) => {
  const { params } = props;

  const classes = useStyles();

  if (params === null || params === undefined || params === "") {
    return null;
  }

  const { data, handleDataChange } = props;

  return (
    <FormControl size="small" className={classes.formControl}>
      <div style={{ width: "300px", marginTop: "1em" }}>
        {params.dataFunc(data, handleDataChange)}
      </div>
    </FormControl>
  );
};

Parameters.propTypes = {
  params: PropTypes.any,
  data: PropTypes.any,
  handleDataChange: PropTypes.func,
};
