import classnames from 'classnames'; import React from 'react'; import Icon from '../icons/Icon.js'; const METHODS_TO_BIND = [ 'getTextboxes', 'handleTextboxChange' ]; export default class TextboxRepeater extends React.Component { constructor() { super(); METHODS_TO_BIND.forEach((method) => { this[method] = this[method].bind(this); }); } getTextboxes() { let textboxes = this.props.textboxes.map((textbox, index) => { let addButton = ( ); let removeButton = null; if (index > 0) { removeButton = ( ); } return (
{removeButton} {addButton}
); }); return textboxes; } handleTextboxChange(index, event) { this.props.handleTextboxChange(index, event.target.value); } render() { return (
{this.getTextboxes()}
); } }