11import { useState } from 'react' ;
22import { ArrowRight } from 'lucide-react' ;
3+ import { Link } from 'react-router' ;
4+ import { toast } from 'react-toastify' ;
35
46const customerCare = [
57 { name : 'My Account' , href : '/login' } ,
@@ -21,24 +23,41 @@ export default function TopFooter() {
2123
2224 const handleSubmit = ( e ) => {
2325 e . preventDefault ( ) ;
24- if ( / ^ [ ^ \s @ ] + @ [ ^ \s @ ] + \. [ ^ \s @ ] + $ / . test ( email ) ) {
25- console . log ( 'Subscribed:' , email ) ;
26- setEmail ( '' ) ;
27- } else {
28- alert ( 'Enter a valid email.' ) ;
26+
27+ const isValidEmail = / ^ [ ^ \s @ ] + @ [ ^ \s @ ] + \. [ ^ \s @ ] + $ / . test ( email . trim ( ) ) ;
28+
29+ if ( ! isValidEmail ) {
30+ toast . error ( 'Please enter a valid email address.' ) ;
31+ return ;
2932 }
33+
34+ // Simulate subscription success (e.g., API call here)
35+ console . log ( 'Subscribed:' , email ) ;
36+
37+ // Show success toast notification
38+ toast . success (
39+ 'Thank you for subscribing! Your email has been received. You’ll now get our latest deals and discounts.'
40+ ) ;
41+
42+ setEmail ( '' ) ;
3043 } ;
3144
3245 return (
3346 < footer className = "bg-neutral-900 text-neutral-200 px-6 py-12" >
3447 < div className = "max-w-7xl mx-auto grid gap-12 md:grid-cols-3" >
3548 { /* Logo + Address */ }
3649 < div >
37- < img
38- src = "/images/official-logo-core-x-footer.svg"
39- alt = "CoreX"
40- className = "mb-4 w-32"
41- />
50+ < Link
51+ to = "/"
52+ className = "inline-block mb-4"
53+ onClick = { ( ) => window . scrollTo ( { top : 0 , behavior : 'smooth' } ) }
54+ >
55+ < img
56+ src = "/images/official-logo-core-x-footer.svg"
57+ alt = "CoreX"
58+ className = "mb-4 w-32"
59+ />
60+ </ Link >
4261 < ul className = "flex space-x-2 mb-4" >
4362 < li >
4463 < a
@@ -97,7 +116,7 @@ export default function TopFooter() {
97116 </ a >
98117 </ li >
99118 </ ul >
100- < address className = "underline not-italic text-sm leading-relaxed" >
119+ < address className = "hover: underline cursor-pointer not-italic text-sm leading-relaxed" >
101120 1234 N Main St,
102121 < br /> Chicago, IL 60607
103122 </ address >
@@ -148,12 +167,12 @@ export default function TopFooter() {
148167 value = { email }
149168 onChange = { ( e ) => setEmail ( e . target . value ) }
150169 placeholder = "Enter your email"
151- className = "flex-grow p-3 bg-neutral-800 text-neutral-200 placeholder-neutral-400 outline-none"
170+ className = "flex-grow p-3 bg-neutral-800 text-neutral-200 placeholder-neutral-400 outline-none hover:bg-neutral-700 hover:ring-1 hover:ring-neutral-500 focus:ring-2 focus:ring-white transition duration-200 ease-in-out "
152171 required
153172 />
154173 < button
155174 type = "submit"
156- className = "p-3 rounded-full bg-white hover:bg-neutral-400 text-neutral-900 transition"
175+ className = "p-3 rounded-full bg-white hover:bg-neutral-400 text-neutral-900 transition cursor-pointer flex items-center justify-center "
157176 aria-label = "Subscribe"
158177 >
159178 < ArrowRight className = "w-5 h-5 text-neutral-900" />
0 commit comments