import React from 'react'
import { Field, reduxForm } from 'redux-form';

import './review-form.scss';

let ReviewForm = props => {
    //const { handleSubmit, postReviewSubmit } = props;
    const { handleSubmit } = props;

    const submit = value => {
        value.date = new Date().toDateString().slice(4);
        console.log(value);
        //postReviewSubmit(value);
    };

    return (
        <form className="form" onSubmit={handleSubmit(submit)}>
            <div>
                <label htmlFor="name">Fullname</label>
                <Field name="name" component="input" type="text" id="name"/>
            </div>
            <div>
                <label htmlFor="text">Your message</label>
                <Field name="text" component="textarea" type="text" id="text"/>
            </div>            
            <button type="submit">Send</button>
        </form>
        )
};

ReviewForm = reduxForm({
    form: 'reviewForm'
})(ReviewForm)

export default ReviewForm