Skip to content

Commit 7971cde

Browse files
committed
added content for contact page
1 parent 5bd49d2 commit 7971cde

File tree

4 files changed

+93
-3
lines changed

4 files changed

+93
-3
lines changed

src/App.tsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { NavBar } from "./components/Navbar";
55
import { Editor } from "./components/Editor";
66
import { Pages } from "./enums/Pages";
77
import { Help } from "./components/Help";
8+
import { Contact } from "./components/Contact";
89

910
function 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
);

src/components/Contact.tsx

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
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+
};

src/consts/Email.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const Email = "[email protected]";

src/enums/pages.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)