import React, { PropTypes } from 'react' import Icon from '../Icon' import * as helpers from '../../helpers' export default class CreatePlaylistModal extends React.Component{ constructor(props){ super(props) this.state = { name: '', description: '', scheme: 'spotify', is_public: true, is_collaborative: false } } createPlaylist(e){ e.preventDefault(); if (!this.state.name || this.state.name == ''){ this.setState({error: 'Name is required'}) return false } else { this.props.coreActions.createPlaylist( this.state.scheme, this.state.name, this.state.description, this.state.is_public, this.state.is_collaborative ) this.props.uiActions.closeModal() } return false } renderFields(){ switch (this.state.scheme){ case 'spotify': return (
Name this.setState({ name: e.target.value })} value={ this.state.name } />
Description this.setState({ description: e.target.value })} value={ this.state.description } />
Options
) default: return (
Name this.setState({ name: e.target.value })} value={ this.state.name } />
) } } render(){ return (

Create playlist

this.createPlaylist(e)}>
Provider
{this.renderFields()}
) } }