Skip to content

Commit d222252

Browse files
committed
feat: enhance GetInvolvedClientPage with smooth scrolling to contact form on submission; update yourselftoscience.pdf
1 parent 48fe0d7 commit d222252

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

public/yourselftoscience.pdf

0 Bytes
Binary file not shown.

src/app/get-involved/GetInvolvedClientPage.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { FaReddit, FaGithub, FaEnvelope } from 'react-icons/fa';
55
import Header from '@/components/Header';
66
import Footer from '@/components/Footer';
77
import { useScroll } from 'framer-motion';
8-
import { useState, useEffect } from 'react';
8+
import { useState, useEffect, useRef } from 'react';
99
import { useSearchParams } from 'next/navigation';
1010

1111
export default function GetInvolvedClientPage() {
@@ -15,12 +15,18 @@ export default function GetInvolvedClientPage() {
1515

1616
const searchParams = useSearchParams();
1717
const [formStatus, setFormStatus] = useState({ submitted: false, error: false });
18+
const contactFormRef = useRef(null);
1819

1920
useEffect(() => {
2021
const submitted = searchParams.get('submitted') === 'true';
2122
const error = searchParams.get('error') === 'true';
2223
if (submitted || error) {
2324
setFormStatus({ submitted, error });
25+
// Scroll to the contact form section after a short delay
26+
// to ensure the DOM is updated before the success/error message appears.
27+
setTimeout(() => {
28+
contactFormRef.current?.scrollIntoView({ behavior: 'smooth', block: 'start' });
29+
}, 100);
2430
}
2531
}, [searchParams]);
2632

@@ -91,7 +97,7 @@ export default function GetInvolvedClientPage() {
9197
</div>
9298

9399
{/* Contact Form Section */}
94-
<div id="contact-us" className="mt-16 pt-12 border-t border-gray-200 scroll-mt-24">
100+
<div id="contact-us" ref={contactFormRef} className="mt-16 pt-12 border-t border-gray-200 scroll-mt-24">
95101
<div className="text-center">
96102
<h2 className="text-3xl font-extrabold text-gray-900 sm:text-4xl">Contact Us</h2>
97103
<p className="mt-4 max-w-2xl mx-auto text-lg text-gray-600">

0 commit comments

Comments
 (0)