diff --git a/src/components/Header.tsx b/src/components/Header.tsx index 6a5c65e..97ad058 100644 --- a/src/components/Header.tsx +++ b/src/components/Header.tsx @@ -26,7 +26,7 @@ const Header = () => { height={60} className="h-12 w-auto" /> - + Au Blé d'Or @@ -71,7 +71,13 @@ const Header = () => { `}>
- Menu + Au Blé d'Or - Boulangerie Artisanale

Au Blé d'Or

+ {/* Button and Form Section */} +
+ + + {/* Form */} + {showLoyaltyForm && ( +
+

Demande de Carte de Fidélité

+ +
+
+
+ + +
+
+ + +
+
+ +
+ + +
+ +
+ + +
+ +
+
+ + +
+
+ + +
+
+ +
+ + +
+ + +
+
+ )} +
@@ -164,11 +263,6 @@ const HomePage = () => {
- - setIsLoyaltyFormOpen(false)} - /> ); }; diff --git a/src/components/LoyaltyCardForm.tsx b/src/components/LoyaltyCardForm.tsx index 1aa03de..76990b2 100644 --- a/src/components/LoyaltyCardForm.tsx +++ b/src/components/LoyaltyCardForm.tsx @@ -1,5 +1,5 @@ 'use client' -import { useState } from 'react'; +import { useState, useEffect, useRef } from 'react'; interface LoyaltyCardFormProps { isOpen: boolean; @@ -7,6 +7,7 @@ interface LoyaltyCardFormProps { } const LoyaltyCardForm = ({ isOpen, onClose }: LoyaltyCardFormProps) => { + const modalRef = useRef(null); const [formData, setFormData] = useState({ firstName: '', lastName: '', @@ -17,11 +18,20 @@ const LoyaltyCardForm = ({ isOpen, onClose }: LoyaltyCardFormProps) => { email: '', }); + useEffect(() => { + if (isOpen) { + document.body.style.overflow = 'hidden'; + } else { + document.body.style.overflow = 'unset'; + } + return () => { + document.body.style.overflow = 'unset'; + }; + }, [isOpen]); + const handleSubmit = (e: React.FormEvent) => { e.preventDefault(); - // Handle form submission here console.log('Form submitted:', formData); - // Reset form and close overlay setFormData({ firstName: '', lastName: '', @@ -37,15 +47,29 @@ const LoyaltyCardForm = ({ isOpen, onClose }: LoyaltyCardFormProps) => { if (!isOpen) return null; return ( -
-
-
+
+
+ {/* This element centers the modal */} + + + {/* Modal */} +
e.stopPropagation()} + >
-

Demande de Carte de Fidélité

+

+ Demande de Carte de Fidélité +

-
- - setFormData({ ...formData, firstName: e.target.value })} - /> +
+
+ + setFormData({ ...formData, firstName: e.target.value })} + /> +
+
+ + setFormData({ ...formData, lastName: e.target.value })} + /> +
- - setFormData({ ...formData, lastName: e.target.value })} - /> -
- -
- + setFormData({ ...formData, age: e.target.value })} />
- + setFormData({ ...formData, address: e.target.value })} />
-
- - setFormData({ ...formData, postalCode: e.target.value })} - /> +
+
+ + setFormData({ ...formData, postalCode: e.target.value })} + /> +
+
+ + setFormData({ ...formData, city: e.target.value })} + /> +
- - setFormData({ ...formData, city: e.target.value })} - /> -
- -
- + setFormData({ ...formData, email: e.target.value })} /> @@ -141,7 +174,7 @@ const LoyaltyCardForm = ({ isOpen, onClose }: LoyaltyCardFormProps) => {