import React from 'react'; import { connect } from 'react-redux'; import { updateMetadata } from '../actions'; class MetadataInputs extends React.Component { constructor (props) { super(props); this.state = { showInputs: false, }; this.toggleShowInputs = this.toggleShowInputs.bind(this); this.handleInput = this.handleInput.bind(this); this.handleCheck = this.handleCheck.bind(this); this.handleSelection = this.handleSelection.bind(this); } toggleShowInputs () { this.setState({'showInputs': !this.state.showInputs}); } handleInput (event) { event.preventDefault(); const name = event.target.name; const value = event.target.value; this.props.onMetadataChange(name, value); } handleCheck (event) { console.log('handle input', event); event.preventDefault(); const name = event.target.name; const value = event.target.checked; this.props.onMetadataChange(name, value); } handleSelection (event) { const name = event.target.name; const selectedOption = event.target.selectedOptions[0].value; this.props.onMetadataChange(name, selectedOption); } render () { return (