import React from 'react'; import ExpandingTextArea from 'components/ExpandingTextArea'; class PublishMetadataInputs extends React.Component { constructor (props) { super(props); this.toggleShowInputs = this.toggleShowInputs.bind(this); this.handleInput = this.handleInput.bind(this); this.handleSelect = this.handleSelect.bind(this); } toggleShowInputs () { this.props.onToggleMetadataInputs(!this.props.showMetadataInputs); } handleInput (event) { const target = event.target; const value = target.type === 'checkbox' ? target.checked : target.value; const name = target.name; this.props.onMetadataChange(name, value); } handleSelect (event) { const name = event.target.name; const selectedOption = event.target.selectedOptions[0].value; this.props.onMetadataChange(name, selectedOption); } render () { return (
{this.props.showMetadataInputs && (
)} {this.props.showMetadataInputs ? '[less]' : '[more]'}
); } } export default PublishMetadataInputs;