import React from 'react'; const LOGIN = 'login'; const CREATE = 'create'; class ChannelLoginForm extends React.Component { constructor (props) { super(props); } render () { return (

Channel Login Form

); } } class ChannelCreateForm extends React.Component { constructor (props) { super(props); } render () { return (

Create Channel Form

); } } class ChannelSelector extends React.Component { constructor (props) { super(props); this.state = { displayCreateOrLogin: null, }; this.toggleCreateOrLogin = this.toggleCreateOrLogin.bind(this); } toggleCreateOrLogin (event) { const selectedOption = event.target.selectedOptions[0].value; if (selectedOption === 'login') { this.setState({ displayCreateOrLogin: LOGIN }); } else if (selectedOption === 'create') { this.setState({ displayCreateOrLogin: CREATE }); } else { this.setState({ displayCreateOrLogin: null }); } } render () { return (
{ this.props.publishToChannel && (

{this.props.channelError}

{ (this.state.displayCreateOrLogin === LOGIN) && } { (this.state.displayCreateOrLogin === CREATE) && }
)}
); } } module.exports = ChannelSelector;