import React from 'react'; import ExpandingTextArea from 'components/ExpandingTextArea'; class PublishMetadataInputs extends React.Component { constructor (props) { super(props); this.state = { showInputs: false, }; this.toggleShowInputs = this.toggleShowInputs.bind(this); this.handleDescriptionInput = this.handleDescriptionInput.bind(this); this.handleNsfwCheck = this.handleNsfwCheck.bind(this); this.handleLicenseSelection = this.handleLicenseSelection.bind(this); } toggleShowInputs () { this.setState({'showInputs': !this.state.showInputs}); } handleDescriptionInput (event) { event.preventDefault(); const name = event.target.name; const value = event.target.value; this.props.onMetadataChange(name, value); } handleNsfwCheck (event) { console.log('handle input', event); event.preventDefault(); const name = event.target.name; const value = event.target.checked; this.props.onMetadataChange(name, value); } handleLicenseSelection (event) { const name = event.target.name; const selectedOption = event.target.selectedOptions[0].value; this.props.onMetadataChange(name, selectedOption); } render () { return (
{this.state.showInputs ? '[less]' : '[more]'} {this.state.showInputs && (
)}
); } } export default PublishMetadataInputs;