diff --git a/src/App.js b/src/App.js index 3b0d622..83fecd2 100644 --- a/src/App.js +++ b/src/App.js @@ -1,7 +1,7 @@ -import React from "react"; +import React, {Component} from "react"; import { BrowserRouter, Route, Switch } from "react-router-dom"; import About from "./components/About"; -import Contact from "./components/Contact"; +import ContactForm from "./components/Contact"; import Home from "./components/Home"; import PostDetail from "./components/PostDetail"; import Blog from "./components/Blog"; @@ -13,7 +13,7 @@ function App() { - + diff --git a/src/components/Contact.js b/src/components/Contact.js index 583ed85..494245e 100644 --- a/src/components/Contact.js +++ b/src/components/Contact.js @@ -1,5 +1,55 @@ -import React from "react"; +import React, {Component} from "react"; -export default function Contact(props) { - return
Contact
; +class ContactForm extends Component { + constructor(props) { + super(props); + this.state = { + name: 'Write your full name here.', + email: 'Write your email here.', + subject: 'Write why you are writing here.', + message: 'Write your message here.' + }; + + this.handleChange = this.handleChange.bind(this); + this.handleSubmit = this.handleSubmit.bind(this); + } + + handleChange(event) { + this.setState({name: event.target.name}); + this.setState({email: event.target.email}); + this.setState({subject: event.target.subject}); + this.setState({message: event.target.message}); + } + + handleSubmit(event) { + alert('You will get and email from us shortly!'); + alert('These are the details you have submitted!' + this.state.name); + event.preventDefault(); + } + + render() { + return ( +
+ + +