Skip to content

Commit 36f0137

Browse files
committed
#96 - ContactForm now uses alert component instead of static declaration.
1 parent 19e302e commit 36f0137

File tree

1 file changed

+6
-22
lines changed

1 file changed

+6
-22
lines changed

src/components/Contact.js

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { useState, useEffect, useCallback } from "react";
2-
//import AlertComponent from "./AlertComponent";
2+
import AlertComponent from "./AlertComponent";
33

44
function ContactForm() {
55
const isDevelopment = process.env.NODE_ENV === "development";
@@ -8,13 +8,6 @@ function ContactForm() {
88
const [message, setMessage] = useState("");
99
const [animateAlert, setAnimateAlert] = useState(false);
1010

11-
const hideAlert = () => {
12-
const alertElement = document.querySelector(".alert-container");
13-
if (alertElement) {
14-
alertElement.classList.add("hidden");
15-
}
16-
};
17-
1811
useEffect(() => {
1912
const timer = setTimeout(() => {
2013
setAnimateAlert(true);
@@ -70,24 +63,15 @@ function ContactForm() {
7063
<div className="formFlex">
7164

7265
{/* Alert Message */}
73-
<div className={`alert-container ${animateAlert ? "" : "hidden"}`} id="alert">
74-
<p style={{ margin: "0" }}>
66+
<AlertComponent message={
67+
<>
7568
This website serves as a showcase of my development work. The source code is hosted on GitHub and deployed via my personal Netlify account.
7669
Therefore, all emails sent through this form will be directed to me. For inquiries related to
7770
<strong className="purple"> Studio Zed</strong>, please contact
7871
<a href="https://www.newcastle.edu.au/profile/simone-ocallaghan"> Dr. Simone O'Callaghan</a>.
79-
</p>
80-
<button onClick={hideAlert}
81-
style={{
82-
backgroundColor: "transparent",
83-
border: "none",
84-
color: "#721c24",
85-
cursor: "pointer",
86-
float: "right",
87-
}}>
88-
&#x2715;
89-
</button>
90-
</div>
72+
</>
73+
}
74+
animateAlert={animateAlert} />
9175

9276
{/* Form */}
9377
<div className="form">

0 commit comments

Comments
 (0)