import builders from '../Elements/builders';
import components from '../Elements/components';
import props from '../Elements/props/common';
import { getValueName } from '../Elements/tools';

export function buildElement(name) {
  const valueName = getValueName(name);
  const Component = components[name];
  const elementProps = props[name];

  const builder = builders[name];
  const Element = builder({
    name,
    valueName,
    Component,
    ...elementProps,
  });

  return Element;
}
