2016-07-13 22:13:28 +02:00
|
|
|
import React, { PropTypes } from 'react';
|
|
|
|
|
|
|
|
function NewFileForm(props) {
|
|
|
|
const { fields: { name }, handleSubmit } = props;
|
|
|
|
return (
|
|
|
|
<form className="new-file-form" onSubmit={handleSubmit(props.createFile.bind(this))}>
|
|
|
|
<label className="new-file-form__name-label" htmlFor="name">Name:</label>
|
|
|
|
<input
|
|
|
|
className="new-file-form__name-input"
|
|
|
|
id="name"
|
|
|
|
type="text"
|
|
|
|
placeholder="Name"
|
|
|
|
{...name}
|
|
|
|
/>
|
2016-07-31 04:46:48 +02:00
|
|
|
<input type="submit" value="Add File" aria-label="add file" />
|
2016-07-13 22:13:28 +02:00
|
|
|
</form>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
NewFileForm.propTypes = {
|
|
|
|
fields: PropTypes.shape({
|
|
|
|
name: PropTypes.string.isRequired
|
|
|
|
}).isRequired,
|
|
|
|
handleSubmit: PropTypes.func.isRequired,
|
|
|
|
createFile: PropTypes.func.isRequired
|
|
|
|
};
|
|
|
|
|
|
|
|
export default NewFileForm;
|