import React from 'react';
import _ from 'lodash';
import styled from 'styled-components';
import { FormTextField, FormSelectField, FormCheckboxField } from './forms';
import { useForm } from './FormProvider';
const FormArgumentsWrapper = styled.div``;
function FormArgument({ arg, namePrefix }) {
const name = `${namePrefix}${arg.name}`;
if (arg.type == 'text') {
return ;
}
if (arg.type == 'checkbox') {
return ;
}
if (arg.type == 'select') {
return (
{arg.options.map(opt =>
_.isString(opt) ? :
)}
);
}
return null;
}
export default function FormArgumentList({ args, onChangeValues = undefined, namePrefix }) {
const { values } = useForm();
React.useEffect(() => {
if (onChangeValues) onChangeValues(values);
}, [values]);
return (
{' '}
{args.map(arg => (
))}
);
}