import React from "react" export default class extends React.Component { isValidated() { return typeof this.props.validation !== "undefined" } getClassName() { let className = "form-group" if (this.isValidated()) { className += " has-feedback" if (this.props.validation === null) { className += " has-success" } else { className += " has-error" } } return className } getFeedback() { if (this.props.validation) { return (
{this.props.validation.map((error, i) => { return

{error}

})}
) } else { return null } } getFeedbackDescription() { if (this.isValidated()) { return ( {this.props.validation ? gettext("(error)") : gettext("(success)")} ) } else { return null } } getHelpText() { if (this.props.helpText) { return

{this.props.helpText}

} else { return null } } render() { return (
{this.props.children} {this.getFeedbackDescription()} {this.getFeedback()} {this.getHelpText()} {this.props.extra || null}
) } }