Created
July 4, 2018 15:24
-
-
Save championshuttler/a29ccb94de2e74e18c83e90110d19cd9 to your computer and use it in GitHub Desktop.
reactjs snippet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div className="EditableCollectionAddon-notes"> | |
<h4 className="EditableCollectionAddon-notes-header"> | |
<Icon name="comments-blue" /> | |
{i18n.gettext('Leave a note')} | |
</h4> | |
{this.state.editingNote ? ( | |
<React.Fragment> | |
{errorHandler.renderErrorIfPresent()} | |
<DismissibleTextForm | |
className="EditableCollectionAddon-notes-form" | |
microButtons | |
onDelete={addon.notes ? this.onDeleteNote : null} | |
onDismiss={this.onDismissNoteForm} | |
onSubmit={this.onSaveNote} | |
placeholder={i18n.gettext('Add a comment about this add-on.')} | |
submitButtonText={i18n.gettext('Save')} | |
text={addon.notes || null} | |
/> | |
</React.Fragment> | |
) : ( | |
<div className="EditableCollectionAddon-notes-read-only"> | |
<span | |
className="EditableCollectionAddon-notes-content" | |
// eslint-disable-next-line react/no-danger | |
dangerouslySetInnerHTML={sanitizeHTML( | |
nl2br(addon.notes || ''), | |
['br'], | |
)} | |
/> | |
<div className="EditableCollectionAddon-notes-buttons"> | |
<Button | |
buttonType="action" | |
className="EditableCollectionAddon-notes-edit-button" | |
micro | |
onClick={this.onEditNote} | |
> | |
{i18n.gettext('Edit')} | |
</Button> | |
</div> | |
</div> | |
)} | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment