);
}
/**
* Render the form heading based on showTitle prop
* @private
* @returns {Void|DOMElement} - The heading or an empty element
*/
_renderHeading() {
const { showTitle } = this.props;
if (showTitle) {
return (
{ I18n.t("components.add_comment_form.title") }
);
}
return null;
}
/**
* Render the form heading based on showTitle prop
* @private
* @returns {Void|DOMElement} - The heading or an empty element
*/
_renderTextArea() {
const { commentableType, commentableId, autoFocus} = this.props;
let textAreaProps = {
ref: (textarea) => {this.bodyTextArea = textarea},
id: `add-comment-${commentableType}-${commentableId}`,
rows: "4",
placeholder: I18n.t("components.add_comment_form.form.body.placeholder"),
onChange: (evt) => this._checkCommentBody(evt.target.value)
};
if (autoFocus) {
textAreaProps.autoFocus = 'autoFocus';
}
return (
);
}
/**
* Render opinion buttons or not based on the arguable prop
* @private
* @returns {Void|DOMElement} - Returns nothing or a wrapper with buttons
*/
_renderOpinionButtons() {
const { arguable } = this.props;
const { alignment } = this.state;
const buttonClassName = classnames('button', 'small', 'button--muted');
const okButtonClassName = classnames(buttonClassName, 'opinion-toggle--ok', {
'is-active': alignment === 1
});
const koButtonClassName = classnames(buttonClassName, 'opinion-toggle--ko', {
'is-active': alignment === -1
});
const neutralButtonClassName = classnames(buttonClassName, 'opinion-toggle--neutral', {
'is-active': alignment === 0
});
if (arguable) {
return (