From df3268f494fe3e56f168cc40c8088ab76142df08 Mon Sep 17 00:00:00 2001 From: Paul Fresnel Date: Sat, 9 Nov 2024 15:15:50 +0100 Subject: [PATCH] form added --- src/components/Header.tsx | 52 +++++++++- src/components/HomePage.tsx | 15 ++- src/components/LoyaltyCardForm.tsx | 155 +++++++++++++++++++++++++++++ 3 files changed, 218 insertions(+), 4 deletions(-) create mode 100644 src/components/LoyaltyCardForm.tsx diff --git a/src/components/Header.tsx b/src/components/Header.tsx index 1799996..6a5c65e 100644 --- a/src/components/Header.tsx +++ b/src/components/Header.tsx @@ -1,7 +1,11 @@ +'use client' +import { useState } from 'react'; import Link from 'next/link'; import Image from 'next/image'; const Header = () => { + const [isMobileMenuOpen, setIsMobileMenuOpen] = useState(false); + const navItems = [ { label: 'Nos Produits', href: '/produits' }, { label: 'Notre Histoire', href: '/notre-histoire' }, @@ -10,7 +14,7 @@ const Header = () => { ]; return ( -
+
{/* Logo */} @@ -27,7 +31,7 @@ const Header = () => { - {/* Navigation */} + {/* Desktop Navigation */} {/* Mobile menu button */} -
+ + {/* Mobile Navigation */} +
+
+
+ Menu + +
+ +
+
); diff --git a/src/components/HomePage.tsx b/src/components/HomePage.tsx index 06a6e90..b1277cd 100644 --- a/src/components/HomePage.tsx +++ b/src/components/HomePage.tsx @@ -1,7 +1,12 @@ +'use client' import Link from 'next/link'; import Image from 'next/image'; +import { useState } from 'react'; +import LoyaltyCardForm from './LoyaltyCardForm'; const HomePage = () => { + const [isLoyaltyFormOpen, setIsLoyaltyFormOpen] = useState(false); + return (
{/* Hero Section */} @@ -117,7 +122,10 @@ const HomePage = () => {
- @@ -156,6 +164,11 @@ const HomePage = () => { + + setIsLoyaltyFormOpen(false)} + /> ); }; diff --git a/src/components/LoyaltyCardForm.tsx b/src/components/LoyaltyCardForm.tsx new file mode 100644 index 0000000..1aa03de --- /dev/null +++ b/src/components/LoyaltyCardForm.tsx @@ -0,0 +1,155 @@ +'use client' +import { useState } from 'react'; + +interface LoyaltyCardFormProps { + isOpen: boolean; + onClose: () => void; +} + +const LoyaltyCardForm = ({ isOpen, onClose }: LoyaltyCardFormProps) => { + const [formData, setFormData] = useState({ + firstName: '', + lastName: '', + age: '', + address: '', + postalCode: '', + city: '', + email: '', + }); + + const handleSubmit = (e: React.FormEvent) => { + e.preventDefault(); + // Handle form submission here + console.log('Form submitted:', formData); + // Reset form and close overlay + setFormData({ + firstName: '', + lastName: '', + age: '', + address: '', + postalCode: '', + city: '', + email: '', + }); + onClose(); + }; + + if (!isOpen) return null; + + return ( +
+
+
+
+

Demande de Carte de Fidélité

+ +
+ +
+
+ + setFormData({ ...formData, firstName: 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, city: e.target.value })} + /> +
+ +
+ + setFormData({ ...formData, email: e.target.value })} + /> +
+ + +
+
+
+
+ ); +}; + +export default LoyaltyCardForm; \ No newline at end of file