Merge version_3 into main #3
331
src/app/checkout/page.tsx
Normal file
331
src/app/checkout/page.tsx
Normal file
@@ -0,0 +1,331 @@
|
||||
"use client";
|
||||
|
||||
import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider";
|
||||
import NavbarStyleApple from "@/components/navbar/NavbarStyleApple/NavbarStyleApple";
|
||||
import ContactCTA from "@/components/sections/contact/ContactCTA";
|
||||
import FooterBaseCard from "@/components/sections/footer/FooterBaseCard";
|
||||
import { MessageSquare } from "lucide-react";
|
||||
import { useState } from "react";
|
||||
|
||||
export default function CheckoutPage() {
|
||||
const [formData, setFormData] = useState({
|
||||
firstName: "", lastName: "", email: "", phone: "", address: "", city: "", state: "", zipCode: "", cardNumber: "", expiryDate: "", cvv: ""});
|
||||
|
||||
const [orderPlaced, setOrderPlaced] = useState(false);
|
||||
|
||||
const navItems = [
|
||||
{ name: "Home", id: "/" },
|
||||
{ name: "Menu", id: "/menu" },
|
||||
{ name: "Order", id: "/order" },
|
||||
{ name: "Locations", id: "/locations" },
|
||||
{ name: "Promotions", id: "/promotions" },
|
||||
];
|
||||
|
||||
const footerColumns = [
|
||||
{
|
||||
title: "Quick Links", items: [
|
||||
{ label: "Home", href: "/" },
|
||||
{ label: "Menu", href: "/menu" },
|
||||
{ label: "Order Online", href: "/order" },
|
||||
{ label: "Locations", href: "/locations" },
|
||||
],
|
||||
},
|
||||
{
|
||||
title: "Company", items: [
|
||||
{ label: "About Us", href: "/about" },
|
||||
{ label: "Careers", href: "/careers" },
|
||||
{ label: "Blog", href: "/blog" },
|
||||
{ label: "Press", href: "/press" },
|
||||
],
|
||||
},
|
||||
{
|
||||
title: "Support", items: [
|
||||
{ label: "Contact", href: "/contact" },
|
||||
{ label: "FAQ", href: "#faq" },
|
||||
{ label: "Track Order", href: "/track" },
|
||||
{ label: "Returns", href: "/returns" },
|
||||
],
|
||||
},
|
||||
{
|
||||
title: "Social", items: [
|
||||
{ label: "Facebook", href: "https://facebook.com/mcdonalds" },
|
||||
{ label: "Instagram", href: "https://instagram.com/mcdonalds" },
|
||||
{ label: "Twitter", href: "https://twitter.com/mcdonalds" },
|
||||
{ label: "YouTube", href: "https://youtube.com/mcdonalds" },
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
const handleChange = (e: React.ChangeEvent<HTMLInputElement | HTMLSelectElement>) => {
|
||||
const { name, value } = e.target;
|
||||
setFormData(prev => ({
|
||||
...prev,
|
||||
[name]: value
|
||||
}));
|
||||
};
|
||||
|
||||
const handleSubmit = (e: React.FormEvent<HTMLFormElement>) => {
|
||||
e.preventDefault();
|
||||
setOrderPlaced(true);
|
||||
setTimeout(() => {
|
||||
window.location.href = "/";
|
||||
}, 3000);
|
||||
};
|
||||
|
||||
return (
|
||||
<ThemeProvider
|
||||
defaultButtonVariant="hover-bubble"
|
||||
defaultTextAnimation="background-highlight"
|
||||
borderRadius="pill"
|
||||
contentWidth="smallMedium"
|
||||
sizing="large"
|
||||
background="blurBottom"
|
||||
cardStyle="gradient-bordered"
|
||||
primaryButtonStyle="primary-glow"
|
||||
secondaryButtonStyle="glass"
|
||||
headingFontWeight="light"
|
||||
>
|
||||
<div id="nav" data-section="nav">
|
||||
<NavbarStyleApple brandName="McDonald's" navItems={navItems} />
|
||||
</div>
|
||||
|
||||
<div className="min-h-screen py-16">
|
||||
<div className="max-w-2xl mx-auto px-4">
|
||||
{orderPlaced ? (
|
||||
<div className="text-center py-20">
|
||||
<div className="mb-6">
|
||||
<div className="w-16 h-16 bg-green-500 rounded-full flex items-center justify-center mx-auto mb-4">
|
||||
<svg className="w-8 h-8 text-white" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M5 13l4 4L19 7" />
|
||||
</svg>
|
||||
</div>
|
||||
<h2 className="text-3xl font-bold text-green-600 mb-2">Order Placed Successfully!</h2>
|
||||
<p className="text-gray-600 mb-2">Thank you for your order.</p>
|
||||
<p className="text-gray-500 text-sm">Redirecting to home page...</p>
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
<div>
|
||||
<h1 className="text-4xl font-bold mb-2">Checkout</h1>
|
||||
<p className="text-gray-600 mb-8">Complete your order by providing your details and payment information.</p>
|
||||
|
||||
<form onSubmit={handleSubmit} className="space-y-8">
|
||||
{/* Personal Information */}
|
||||
<div className="bg-white rounded-lg p-6 shadow-md">
|
||||
<h2 className="text-2xl font-semibold mb-6">Personal Information</h2>
|
||||
<div className="grid grid-cols-2 gap-4">
|
||||
<div>
|
||||
<label className="block text-sm font-medium mb-2">First Name *</label>
|
||||
<input
|
||||
type="text"
|
||||
name="firstName"
|
||||
value={formData.firstName}
|
||||
onChange={handleChange}
|
||||
required
|
||||
className="w-full px-4 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500"
|
||||
placeholder="John"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label className="block text-sm font-medium mb-2">Last Name *</label>
|
||||
<input
|
||||
type="text"
|
||||
name="lastName"
|
||||
value={formData.lastName}
|
||||
onChange={handleChange}
|
||||
required
|
||||
className="w-full px-4 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500"
|
||||
placeholder="Doe"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div className="grid grid-cols-2 gap-4 mt-4">
|
||||
<div>
|
||||
<label className="block text-sm font-medium mb-2">Email *</label>
|
||||
<input
|
||||
type="email"
|
||||
name="email"
|
||||
value={formData.email}
|
||||
onChange={handleChange}
|
||||
required
|
||||
className="w-full px-4 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500"
|
||||
placeholder="john@example.com"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label className="block text-sm font-medium mb-2">Phone *</label>
|
||||
<input
|
||||
type="tel"
|
||||
name="phone"
|
||||
value={formData.phone}
|
||||
onChange={handleChange}
|
||||
required
|
||||
className="w-full px-4 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500"
|
||||
placeholder="(555) 123-4567"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Delivery Address */}
|
||||
<div className="bg-white rounded-lg p-6 shadow-md">
|
||||
<h2 className="text-2xl font-semibold mb-6">Delivery Address</h2>
|
||||
<div className="mb-4">
|
||||
<label className="block text-sm font-medium mb-2">Street Address *</label>
|
||||
<input
|
||||
type="text"
|
||||
name="address"
|
||||
value={formData.address}
|
||||
onChange={handleChange}
|
||||
required
|
||||
className="w-full px-4 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500"
|
||||
placeholder="123 Main Street"
|
||||
/>
|
||||
</div>
|
||||
<div className="grid grid-cols-3 gap-4">
|
||||
<div>
|
||||
<label className="block text-sm font-medium mb-2">City *</label>
|
||||
<input
|
||||
type="text"
|
||||
name="city"
|
||||
value={formData.city}
|
||||
onChange={handleChange}
|
||||
required
|
||||
className="w-full px-4 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500"
|
||||
placeholder="New York"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label className="block text-sm font-medium mb-2">State *</label>
|
||||
<input
|
||||
type="text"
|
||||
name="state"
|
||||
value={formData.state}
|
||||
onChange={handleChange}
|
||||
required
|
||||
className="w-full px-4 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500"
|
||||
placeholder="NY"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label className="block text-sm font-medium mb-2">ZIP Code *</label>
|
||||
<input
|
||||
type="text"
|
||||
name="zipCode"
|
||||
value={formData.zipCode}
|
||||
onChange={handleChange}
|
||||
required
|
||||
className="w-full px-4 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500"
|
||||
placeholder="10001"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Payment Information */}
|
||||
<div className="bg-white rounded-lg p-6 shadow-md">
|
||||
<h2 className="text-2xl font-semibold mb-6">Payment Information</h2>
|
||||
<div className="mb-4">
|
||||
<label className="block text-sm font-medium mb-2">Card Number *</label>
|
||||
<input
|
||||
type="text"
|
||||
name="cardNumber"
|
||||
value={formData.cardNumber}
|
||||
onChange={handleChange}
|
||||
required
|
||||
className="w-full px-4 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500"
|
||||
placeholder="1234 5678 9012 3456"
|
||||
maxLength="19"
|
||||
/>
|
||||
</div>
|
||||
<div className="grid grid-cols-2 gap-4">
|
||||
<div>
|
||||
<label className="block text-sm font-medium mb-2">Expiry Date *</label>
|
||||
<input
|
||||
type="text"
|
||||
name="expiryDate"
|
||||
value={formData.expiryDate}
|
||||
onChange={handleChange}
|
||||
required
|
||||
className="w-full px-4 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500"
|
||||
placeholder="MM/YY"
|
||||
maxLength="5"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label className="block text-sm font-medium mb-2">CVV *</label>
|
||||
<input
|
||||
type="text"
|
||||
name="cvv"
|
||||
value={formData.cvv}
|
||||
onChange={handleChange}
|
||||
required
|
||||
className="w-full px-4 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500"
|
||||
placeholder="123"
|
||||
maxLength="3"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Order Summary */}
|
||||
<div className="bg-blue-50 rounded-lg p-6 border border-blue-200">
|
||||
<h2 className="text-2xl font-semibold mb-4">Order Summary</h2>
|
||||
<div className="space-y-2 mb-4">
|
||||
<div className="flex justify-between">
|
||||
<span>Subtotal:</span>
|
||||
<span>$24.97</span>
|
||||
</div>
|
||||
<div className="flex justify-between">
|
||||
<span>Delivery Fee:</span>
|
||||
<span>$3.99</span>
|
||||
</div>
|
||||
<div className="flex justify-between">
|
||||
<span>Tax:</span>
|
||||
<span>$2.23</span>
|
||||
</div>
|
||||
<div className="border-t pt-2 flex justify-between font-bold text-lg">
|
||||
<span>Total:</span>
|
||||
<span>$31.19</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Submit Button */}
|
||||
<button
|
||||
type="submit"
|
||||
className="w-full bg-blue-600 text-white font-bold py-3 px-6 rounded-lg hover:bg-blue-700 transition"
|
||||
>
|
||||
Complete Order
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="contact" data-section="contact">
|
||||
<ContactCTA
|
||||
tag="Need Help?"
|
||||
tagIcon={MessageSquare}
|
||||
title="Questions About Your Order?"
|
||||
description="Our customer support team is here to help. Contact us anytime for assistance."
|
||||
background={{ variant: "animated-grid" }}
|
||||
useInvertedBackground={false}
|
||||
buttons={[
|
||||
{ text: "Contact Support", href: "/contact" },
|
||||
{ text: "Track Order", href: "/track" },
|
||||
]}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div id="footer" data-section="footer">
|
||||
<FooterBaseCard
|
||||
logoText="McDonald's"
|
||||
columns={footerColumns}
|
||||
copyrightText="© 2025 McDonald's Corporation. All rights reserved."
|
||||
/>
|
||||
</div>
|
||||
</ThemeProvider>
|
||||
);
|
||||
}
|
||||
@@ -111,8 +111,7 @@ export default function HomePage() {
|
||||
const productsWithHandlers = products.map((product) => ({
|
||||
...product,
|
||||
onProductClick: () => {
|
||||
setSelectedProduct(product.name);
|
||||
setIsModalOpen(true);
|
||||
window.location.href = "/checkout";
|
||||
},
|
||||
}));
|
||||
|
||||
@@ -293,33 +292,6 @@ export default function HomePage() {
|
||||
copyrightText="© 2025 McDonald's Corporation. All rights reserved."
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* Product Details Modal */}
|
||||
{isModalOpen && (
|
||||
<div
|
||||
className="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50"
|
||||
onClick={() => setIsModalOpen(false)}
|
||||
>
|
||||
<div
|
||||
className="bg-white rounded-lg p-8 max-w-md w-full mx-4"
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
>
|
||||
<h2 className="text-2xl font-bold mb-4">Product Details</h2>
|
||||
<p className="text-gray-600 mb-6">
|
||||
You selected: <strong>{selectedProduct}</strong>
|
||||
</p>
|
||||
<p className="text-gray-500 mb-6">
|
||||
This is a product details modal. In a real application, this would display detailed information about the selected item.
|
||||
</p>
|
||||
<button
|
||||
onClick={() => setIsModalOpen(false)}
|
||||
className="w-full bg-blue-600 text-white py-2 px-4 rounded-lg hover:bg-blue-700 transition"
|
||||
>
|
||||
Close
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</ThemeProvider>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user