Skip to content

Commit

Permalink
updating form to redirect to thank you page when complete
Browse files Browse the repository at this point in the history
  • Loading branch information
jhoude5 committed Sep 27, 2024
1 parent f0f5ae1 commit 961d4ad
Show file tree
Hide file tree
Showing 10 changed files with 71 additions and 21 deletions.
5 changes: 2 additions & 3 deletions src/pages/adoption/adoption-application.en.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import Header from '../../components/header';
import '../../sass/styles.scss';
import Footer from '../../components/footer';
import Volunteer from '../../components/volunteer';
import { navigate } from 'gatsby';


const AdoptionApplication = () => {
Expand Down Expand Up @@ -40,9 +41,7 @@ const AdoptionApplication = () => {
body: new URLSearchParams(formData).toString(),
})
.then(() => {
document.querySelector('.success').innerText =
"Thank you for reaching out to us, we'd get back to you shortly.";
document.getElementById('success').scrollIntoView();
navigate("/en/thank-you/");
// Clear form fields
setName('');
setEmail('');
Expand Down
5 changes: 2 additions & 3 deletions src/pages/adoption/adoption-application.fr.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import Header from '../../components/fr/header';
import '../../sass/styles.scss';
import Footer from '../../components/fr/footer';
import Volunteer from '../../components/volunteer';
import { navigate } from 'gatsby';


const AdoptionApplication = () => {
Expand Down Expand Up @@ -40,9 +41,7 @@ const AdoptionApplication = () => {
body: new URLSearchParams(formData).toString(),
})
.then(() => {
document.querySelector('.success').innerText =
"Thank you for reaching out to us, we'd get back to you shortly.";
document.getElementById('success').scrollIntoView();
navigate("/fr/thank-you/");
// Clear form fields
setName('');
setEmail('');
Expand Down
8 changes: 5 additions & 3 deletions src/pages/contact.en.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import Header from '../components/header';
import '../sass/styles.scss';
import Footer from "../components/footer";
import Adopt from "../components/adopt";
import { navigate } from 'gatsby';


const Contact = () => {
Expand All @@ -19,9 +20,10 @@ const Contact = () => {
body: new URLSearchParams(formData).toString(),
})
.then(() => {
document.querySelector('.success').innerText =
"Thank you for reaching out to us, we will get back to you shortly.";
document.getElementById('success').scrollIntoView();
// document.querySelector('.success').innerText =
// "Thank you for reaching out to us, we will get back to you shortly.";
// document.getElementById('success').scrollIntoView();
navigate("/en/thank-you/");
// Clear form fields
setName('');
setEmail('');
Expand Down
5 changes: 2 additions & 3 deletions src/pages/contact.fr.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import Header from '../components/fr/header';
import '../sass/styles.scss';
import Footer from '../components/fr/footer';
import Adopt from '../components/fr/adopt';
import { navigate } from 'gatsby';


const Contact = () => {
Expand All @@ -19,9 +20,7 @@ const Contact = () => {
body: new URLSearchParams(formData).toString(),
})
.then(() => {
document.querySelector('.success').innerText =
"Merci de nous avoir contactés, nous vous répondrons sous peu.";
document.getElementById('success').scrollIntoView();
navigate("/fr/thank-you/");
// Clear form fields
setName('');
setEmail('');
Expand Down
5 changes: 2 additions & 3 deletions src/pages/fosters/foster-application.en.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import Header from '../../components/header';
import '../../sass/styles.scss';
import Footer from '../../components/footer';
import Volunteer from '../../components/volunteer';
import { navigate } from 'gatsby';


const FosterApplication = () => {
Expand Down Expand Up @@ -51,9 +52,7 @@ const FosterApplication = () => {
body: new URLSearchParams(formData).toString(),
})
.then(() => {
document.querySelector('.success').innerText =
"Thank you for reaching out to us, we'd get back to you shortly.";
document.getElementById('success').scrollIntoView();
navigate("/en/thank-you/");
// Clear form fields
setName('');
setEmail('');
Expand Down
7 changes: 2 additions & 5 deletions src/pages/fosters/foster-application.fr.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import Header from '../../components/fr/header';
import '../../sass/styles.scss';
import Footer from '../../components/fr/footer';
import Volunteer from '../../components/fr/volunteer';
import { navigate } from 'gatsby';


const FosterApplication = () => {
Expand Down Expand Up @@ -39,8 +40,6 @@ const FosterApplication = () => {
const [acknowledge, setAcknowledge] = useState("");
const [transport, setTranport] = useState("");



const handleSubmit = e => {
e.preventDefault()
const myForm = e.target;
Expand All @@ -51,9 +50,7 @@ const FosterApplication = () => {
body: new URLSearchParams(formData).toString(),
})
.then(() => {
document.querySelector('.success').innerText =
"Merci de nous avoir contactés, nous vous répondrons sous peu.";
document.getElementById('success').scrollIntoView();
navigate("/fr/thank-you/");
// Clear form fields
setName('');
setEmail('');
Expand Down
2 changes: 1 addition & 1 deletion src/pages/index.fr.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,4 +114,4 @@ const IndexPage = () => {
export default IndexPage


export const Head = () => <title>Home Page</title>
export const Head = () => <title>Page d'accueil</title>
26 changes: 26 additions & 0 deletions src/pages/thank-you.en.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import * as React from "react";
import Header from "../components/header";
import Footer from "../components/footer";
import Volunteer from "../components/volunteer";


const Thankyou = () => {
return (
<main>
<Header />
<div className="container thank-you">
<h1>Thank You for reaching out to us</h1>
<p>We will get back to you shortly.</p>
</div>
<section className="volunteers">
<Volunteer />
</section>
<Footer />

</main>
)
}

export default Thankyou

export const Head = () => <title>Thank You</title>
26 changes: 26 additions & 0 deletions src/pages/thank-you.fr.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import * as React from "react";
import Header from "../components/fr/header";
import Footer from "../components/fr/footer";
import Volunteer from "../components/fr/volunteer";


const Thankyou = () => {
return (
<main>
<Header />
<div className="container thank-you">
<h1>Merci de nous avoir contactés</h1>
<p>Nous vous répondrons sous peu.</p>
</div>
<section className="volunteers">
<Volunteer />
</section>
<Footer />

</main>
)
}

export default Thankyou

export const Head = () => <title>Merci</title>
3 changes: 3 additions & 0 deletions src/sass/pages/forms.scss
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,7 @@
button {
margin-left: 0 !important;
}
}
.thank-you {
padding-bottom: 40px;
}

0 comments on commit 961d4ad

Please sign in to comment.