diff --git a/package.json b/package.json index 4c7b4d1..7b23909 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,7 @@ "popper.js": "^1.16.1", "react": "^17.0.1", "react-dom": "^17.0.1", + "react-icons": "^4.2.0", "react-router-dom": "^5.2.0", "react-scripts": "4.0.0", "styled-components": "^5.2.1", diff --git a/src/components/Contact.js b/src/components/Contact.js index 8414777..c6bd3f6 100644 --- a/src/components/Contact.js +++ b/src/components/Contact.js @@ -2,8 +2,8 @@ import React, {Component} from "react"; import emailjs from "emailjs-com"; import {createGlobalStyle} from 'styled-components'; import {Spring} from 'react-spring/renderprops' -import {StyledFormWrapper, StyledForm, StyledButton, StyledError, StyledInput, StyledTextArea, StyledTextAreaSubject, ButtonSet} from "./assets/StyledContactForm.js"; -import './assets/contact.scss' +import {StyledFormWrapper, StyledForm, StyledButton, StyledError, StyledInput, StyledTextArea, StyledTextAreaSubject, ButtonSet, Modal} from "./assets/StyledContactForm.js"; +import './assets/contact.scss'; // If you need anything for this ask Ram Reddy. @@ -24,12 +24,14 @@ class ContactForm extends Component { constructor(props) { super(props); + this.state = { name: '', email: '', subject: '', message: '', - error:'' + error:'', + show:false }; this.handleNameChange = this.handleNameChange.bind(this); @@ -38,8 +40,18 @@ class ContactForm extends Component { this.handleMessageChange = this.handleMessageChange.bind(this); this.handleSubmit = this.handleSubmit.bind(this); this.scrollDown = this.scrollDown.bind(this); + this.showModal = this.showModal.bind(this); + this.hideModal = this.hideModal.bind(this); } + showModal = () => { + this.setState({ show: true }); + }; + + hideModal = () => { + this.setState({ show: false }); + }; + handleNameChange(event) { this.setState({ name: event.target.value @@ -76,20 +88,16 @@ class ContactForm extends Component { } this.setState({error: ``}); - alert('You will get and email from us shortly!'); - alert('These are the details you have submitted!'); - alert(this.state.name); - alert(this.state.email); - alert(this.state.subject); - alert(this.state.message); + this.showModal() + // emailjs.sendForm('service_5ggwj8d', 'template_jirc6zm', event.target, 'user_XtSzEFFNtc4C6IEpGN9JS') + // .then((result) => { + // console.log(result.text); + // }, (error) => { + // console.log(error.text); + // }); + // event.target.reset(); + - emailjs.sendForm('service_5ggwj8d', 'template_jirc6zm', event.target, 'user_XtSzEFFNtc4C6IEpGN9JS') - .then((result) => { - console.log(result.text); - }, (error) => { - console.log(error.text); - }); - event.target.reset(); } scrollDown(id) { @@ -140,7 +148,15 @@ class ContactForm extends Component { Send Message - + + We have recieved your message! + You will recieve an email from us shortly. + Below are the details you have submitted: + Name: {this.state.name} + Email: {this.state.email} + Subject: {this.state.subject} + Message: {this.state.message} +
Subject: {this.state.subject}
Message: {this.state.message}