import PropTypes from 'prop-types'; import React from 'react'; import { reduxForm } from 'redux-form'; import InlineSVG from 'react-inlinesvg'; import NewFolderForm from './NewFolderForm'; const exitUrl = require('../../../images/exit.svg'); class NewFolderModal extends React.Component { componentDidMount() { this.newFolderModal.focus(); } render() { return (
{ this.newFolderModal = element; }} >

Add Folder

); } } NewFolderModal.propTypes = { closeModal: PropTypes.func.isRequired }; function validate(formProps) { const errors = {}; if (!formProps.name) { errors.name = 'Please enter a name'; } else if (formProps.name.trim().length === 0) { errors.name = 'Folder name cannot contain only spaces'; } return errors; } export default reduxForm({ form: 'new-folder', fields: ['name'], validate })(NewFolderModal);