pesto-students/batch-11-relayer

View on GitHub
client/src/utils/formUtils.js

Summary

Maintainability
A
0 mins
Test Coverage
const createInputField = (...attributes) => {
  const [type, id, label, placeholder] = attributes;
  const inputAttributes = {
    type,
    id,
    placeholder,
    required: 'required',
  };
  if (type === 'password') {
    inputAttributes.minLength = 8;
  }
  return {
    inputType: 'input',
    label: { label, id },
    input: inputAttributes,
  };
};

const createButtonField = (className = '', color = 'primary') => ({
  inputType: 'button',
  button: { color, className },
});

export { createInputField, createButtonField };