import React, {useState} from 'react'; import {BrowserView, MobileView} from "react-device-detect"; import Paper from '@material-ui/core/Paper'; import Button from '@material-ui/core/Button'; import TextField from '@material-ui/core/TextField'; const bodyDivStyle = { margin: "auto", textAlign: "center", width: "900px", } // Should be different if logged in :| const Contact = (props) => { const { globalUrl, isLoaded, surfaceColor, inputColor } = props; const boxStyle = { flex: "1", marginLeft: "10px", marginRight: "10px", paddingLeft: "30px", paddingRight: "30px", paddingBottom: "30px", paddingTop: "30px", backgroundColor: surfaceColor, display: "flex", flexDirection: "column" } const bodyTextStyle = { color: "#ffffff", } const [firstname, setFirstname] = useState(""); const [lastname, setLastname] = useState(""); const [title, setTitle] = useState(""); const [companyname, setCompanyname] = useState(""); const [email, setEmail] = useState(""); const [phone, setPhone] = useState(""); const [message, setMessage] = useState(""); const [formMessage, setFormMessage] = useState(""); const submitContact = () => { const data = { "firstname": firstname, "lastname": lastname, "title": title, "companyname": companyname, "email": email, "phone": phone, "message": message, } console.log(data) fetch(globalUrl+"/api/v1/contact", { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify(data), }) .then(response => response.json()) .then(response => { if (response.success === true) { setFormMessage(response.message) } else { setFormMessage("Something went wrong. Please contact frikky@shuffler.io.") } console.log(response) }) .catch(error => { console.log(error) }); } // Random names for type & autoComplete. Didn't research :^) const landingpageDataBrowser =

Contact us

Lets talk!

Contact Details

setFirstname(e.target.value)} /> setLastname(e.target.value)} />
setTitle(e.target.value)} /> setCompanyname(e.target.value)} />
setEmail(e.target.value)} /> setPhone(e.target.value)} />

Message

setMessage(e.target.value)} />

{formMessage}

const landingpageDataMobile =

Contact us

Lets talk!

Contact Details

setFirstname(e.target.value)} />
setEmail(e.target.value)} />

Message

setMessage(e.target.value)} />

{formMessage}

const loadedCheck = isLoaded ?
{landingpageDataBrowser}
{landingpageDataMobile}
:
return(
{loadedCheck}
) } export default Contact;