File tree Expand file tree Collapse file tree 4 files changed +93
-3
lines changed Expand file tree Collapse file tree 4 files changed +93
-3
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import { NavBar } from "./components/Navbar";
55import { Editor } from "./components/Editor" ;
66import { Pages } from "./enums/Pages" ;
77import { Help } from "./components/Help" ;
8+ import { Contact } from "./components/Contact" ;
89
910function App ( ) {
1011 return (
@@ -13,8 +14,18 @@ function App() {
1314
1415 < Routes >
1516 < Route path = { process . env . PUBLIC_URL } element = { < Automadeasy /> } />
16- < Route path = { `${ process . env . PUBLIC_URL } /${ Pages . Editor } ` } element = { < Editor /> } />
17- < Route path = { `${ process . env . PUBLIC_URL } /${ Pages . Help } ` } element = { < Help /> } />
17+ < Route
18+ path = { `${ process . env . PUBLIC_URL } /${ Pages . Editor } ` }
19+ element = { < Editor /> }
20+ />
21+ < Route
22+ path = { `${ process . env . PUBLIC_URL } /${ Pages . Help } ` }
23+ element = { < Help /> }
24+ />
25+ < Route
26+ path = { `${ process . env . PUBLIC_URL } /${ Pages . Contact } ` }
27+ element = { < Contact /> }
28+ />
1829 </ Routes >
1930 </ Router >
2031 ) ;
Original file line number Diff line number Diff line change 1+ import {
2+ FormControl ,
3+ Container ,
4+ TextField ,
5+ Typography ,
6+ Button ,
7+ } from "@mui/material" ;
8+ import { useState } from "react" ;
9+ import { Email } from "../consts/Email" ;
10+
11+ export const Contact = ( ) => {
12+ const [ subject , setSubject ] = useState ( "" ) ;
13+ const [ email , setEmail ] = useState ( "" ) ;
14+ const [ message , setMessage ] = useState ( "" ) ;
15+
16+ const handleSubmit = ( e : any ) => {
17+ if ( subject !== "" && email !== "" && message !== "" ) {
18+ e . preventDefault ( ) ;
19+ window . location . assign (
20+ `mailto:${ Email } ?subject=${ subject } &body=${ message } `
21+ ) ;
22+ }
23+ } ;
24+
25+ return (
26+ < Container maxWidth = { false } >
27+ < Typography
28+ variant = "h4"
29+ fontWeight = { "bold" }
30+ color = { "black" }
31+ sx = { { p : "1rem 0 3rem" } }
32+ >
33+ Contact Us
34+ </ Typography >
35+ < FormControl fullWidth onSubmit = { handleSubmit } >
36+ { /* <Grid container direction={"column"}>
37+ <Grid item> */ }
38+ < TextField
39+ id = "subject"
40+ label = "Subject"
41+ value = { subject }
42+ onChange = { ( e ) => setSubject ( e ?. target ?. value || "" ) }
43+ sx = { { pb : "1rem" } }
44+ />
45+ { /* </Grid>
46+ <Grid item> */ }
47+ < TextField
48+ id = "email"
49+ label = "Email"
50+ type = "email"
51+ value = { email }
52+ onChange = { ( e ) => setEmail ( e ?. target ?. value || "" ) }
53+ sx = { { pb : "1rem" } }
54+ />
55+ { /* <InputLabel htmlFor="email">Email address</InputLabel>
56+ <Input id="email" aria-describedby="email" />
57+ <FormHelperText id="email">
58+ We'll never share your email.
59+ </FormHelperText> */ }
60+ { /* </Grid>
61+ <Grid item> */ }
62+ < TextField
63+ id = "message"
64+ label = "Message"
65+ multiline
66+ value = { message }
67+ onChange = { ( e ) => setMessage ( e ?. target ?. value || "" ) }
68+ sx = { { pb : "1rem" } }
69+ />
70+ { /* </Grid>
71+ </Grid> */ }
72+ < Button variant = "contained" type = "submit" onClick = { handleSubmit } >
73+ Submit
74+ </ Button >
75+ </ FormControl >
76+ </ Container >
77+ ) ;
78+ } ;
Original file line number Diff line number Diff line change 1+ export const Email = "[email protected] " ;
Original file line number Diff line number Diff line change @@ -6,5 +6,5 @@ export enum Pages {
66 // Request_A_Feature = "request",
77 // Report_A_Problem = "report",
88 Help = "help" ,
9- About = "about " ,
9+ Contact = "contact " ,
1010}
You can’t perform that action at this time.
0 commit comments