|
| 1 | +import { useState } from 'react'; |
| 2 | +import { ArrowRight } from 'lucide-react'; |
| 3 | +import { Link } from 'react-router'; |
| 4 | +import { toast } from 'react-toastify'; |
| 5 | + |
| 6 | +const customerCare = [ |
| 7 | + { name: 'My Account', href: '/login' }, |
| 8 | + { name: 'My Orders', href: '/login' }, |
| 9 | + { name: 'Email Support', href: 'mailto:info@opencodechicago.org' }, |
| 10 | + { name: 'Call Support', href: 'tel:+13125551234' }, |
| 11 | +]; |
| 12 | + |
| 13 | +const information = [ |
| 14 | + { name: 'Shipping Policy', href: '/shipping-policy' }, |
| 15 | + { name: 'Return Policy', href: '/return-policy' }, |
| 16 | + { name: 'Privacy Policy', href: '/privacy-policy' }, |
| 17 | + { name: 'Accessibility', href: '/accessibility' }, |
| 18 | + { name: 'Terms of Service', href: '/terms-of-service' }, |
| 19 | +]; |
| 20 | + |
| 21 | +export default function TopFooter() { |
| 22 | + const [email, setEmail] = useState(''); |
| 23 | + |
| 24 | + const handleSubmit = (e) => { |
| 25 | + e.preventDefault(); |
| 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; |
| 32 | + } |
| 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(''); |
| 43 | + }; |
| 44 | + |
| 45 | + return ( |
| 46 | + <footer className="bg-neutral-900 text-neutral-200 px-6 py-12"> |
| 47 | + <div className="max-w-7xl mx-auto grid gap-12 md:grid-cols-3"> |
| 48 | + {/* Logo + Address */} |
| 49 | + <div> |
| 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> |
| 61 | + <ul className="flex space-x-2 mb-4"> |
| 62 | + <li> |
| 63 | + <a |
| 64 | + href="#" |
| 65 | + target="_blank" |
| 66 | + rel="noopener noreferrer" |
| 67 | + className="text-neutral-300 transition-transform duration-300 ease-in-out" |
| 68 | + > |
| 69 | + <img |
| 70 | + src="/images/youtube_icon.png" |
| 71 | + alt="YouTube" |
| 72 | + className="w-6 h-6 hover:scale-110 transform hover:rotate-2 hover:shadow-lg" |
| 73 | + /> |
| 74 | + </a> |
| 75 | + </li> |
| 76 | + <li> |
| 77 | + <a |
| 78 | + href="#" |
| 79 | + target="_blank" |
| 80 | + rel="noopener noreferrer" |
| 81 | + className="text-neutral-300 transition-transform duration-300 ease-in-out" |
| 82 | + > |
| 83 | + <img |
| 84 | + src="/images/linkedin_icon.png" |
| 85 | + alt="LinkedIn" |
| 86 | + className="w-6 h-6 hover:scale-110 transform hover:rotate-2 hover:shadow-lg" |
| 87 | + /> |
| 88 | + </a> |
| 89 | + </li> |
| 90 | + <li> |
| 91 | + <a |
| 92 | + href="#" |
| 93 | + target="_blank" |
| 94 | + rel="noopener noreferrer" |
| 95 | + className="text-neutral-300 transition-transform duration-300 ease-in-out" |
| 96 | + > |
| 97 | + <img |
| 98 | + src="/images/x_icon.png" |
| 99 | + alt="Twitter" |
| 100 | + className="w-6 h-6 hover:scale-110 transform hover:rotate-2 hover:shadow-lg" |
| 101 | + /> |
| 102 | + </a> |
| 103 | + </li> |
| 104 | + <li> |
| 105 | + <a |
| 106 | + href="#" |
| 107 | + target="_blank" |
| 108 | + rel="noopener noreferrer" |
| 109 | + className="text-neutral-300 transition-transform duration-300 ease-in-out" |
| 110 | + > |
| 111 | + <img |
| 112 | + src="/images/facebook_icon.png" |
| 113 | + alt="Facebook" |
| 114 | + className="w-6 h-6 hover:scale-110 transform hover:rotate-2 hover:shadow-lg" |
| 115 | + /> |
| 116 | + </a> |
| 117 | + </li> |
| 118 | + </ul> |
| 119 | + <address className="hover:underline cursor-pointer not-italic text-sm leading-relaxed"> |
| 120 | + 1234 N Main St, |
| 121 | + <br /> Chicago, IL 60607 |
| 122 | + </address> |
| 123 | + </div> |
| 124 | + |
| 125 | + {/* Navigation Links */} |
| 126 | + <nav className="grid grid-cols-2 gap-8 text-sm"> |
| 127 | + <div> |
| 128 | + <h3 className="font-semibold text-white mb-3">Customer Care</h3> |
| 129 | + <ul className="space-y-2"> |
| 130 | + {customerCare.map((link) => ( |
| 131 | + <li key={link.name}> |
| 132 | + <a |
| 133 | + href={link.href} |
| 134 | + className="text-neutral-300 link-underline transition" |
| 135 | + > |
| 136 | + {link.name} |
| 137 | + </a> |
| 138 | + </li> |
| 139 | + ))} |
| 140 | + </ul> |
| 141 | + </div> |
| 142 | + <div> |
| 143 | + <h3 className="font-semibold text-white mb-3">Information</h3> |
| 144 | + <ul className="space-y-2"> |
| 145 | + {information.map((link) => ( |
| 146 | + <li key={link.name}> |
| 147 | + <a |
| 148 | + href={link.href} |
| 149 | + className="text-neutral-300 link-underline transition" |
| 150 | + > |
| 151 | + {link.name} |
| 152 | + </a> |
| 153 | + </li> |
| 154 | + ))} |
| 155 | + </ul> |
| 156 | + </div> |
| 157 | + </nav> |
| 158 | + |
| 159 | + {/* Newsletter Form */} |
| 160 | + <form onSubmit={handleSubmit} className="flex flex-col justify-center"> |
| 161 | + <h3 className="text-4xl uppercase font-bold mb-4"> |
| 162 | + Get our latest deals and discounts! |
| 163 | + </h3> |
| 164 | + <div className="flex bg-neutral-800 rounded-lg overflow-hidden"> |
| 165 | + <input |
| 166 | + type="email" |
| 167 | + value={email} |
| 168 | + onChange={(e) => setEmail(e.target.value)} |
| 169 | + placeholder="Enter your email" |
| 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" |
| 171 | + required |
| 172 | + /> |
| 173 | + <button |
| 174 | + type="submit" |
| 175 | + className="p-3 rounded-full bg-white hover:bg-neutral-400 text-neutral-900 transition cursor-pointer flex items-center justify-center" |
| 176 | + aria-label="Subscribe" |
| 177 | + > |
| 178 | + <ArrowRight className="w-5 h-5 text-neutral-900" /> |
| 179 | + </button> |
| 180 | + </div> |
| 181 | + <p className="mt-2 text-xs"> |
| 182 | + Become a Core<span className="text-red-500">X</span> Insider! |
| 183 | + </p> |
| 184 | + </form> |
| 185 | + </div> |
| 186 | + </footer> |
| 187 | + ); |
| 188 | +} |
0 commit comments