|
| 1 | +import { motion, AnimatePresence } from "framer-motion"; |
| 2 | +import { Plane, Hotel, MapPin, X, CreditCard, Wallet, CheckCircle2 } from "lucide-react"; |
| 3 | + |
| 4 | +interface ItineraryItem { |
| 5 | + type: 'flight' | 'hotel' | 'activity'; |
| 6 | + title: string; |
| 7 | + details: string; |
| 8 | + price: number; |
| 9 | +} |
| 10 | + |
| 11 | +export const CheckoutModal = ({ items, total, onConfirm, onClose }: { items: ItineraryItem[], total: number, onConfirm: () => void, onClose: () => void }) => { |
| 12 | + return ( |
| 13 | + <motion.div |
| 14 | + initial={{ opacity: 0 }} |
| 15 | + animate={{ opacity: 1 }} |
| 16 | + exit={{ opacity: 0 }} |
| 17 | + className="fixed inset-0 z-[100] flex items-center justify-center p-4 backdrop-blur-2xl bg-black/80" |
| 18 | + > |
| 19 | + <motion.div |
| 20 | + initial={{ opacity: 0, scale: 0.9, y: 30 }} |
| 21 | + animate={{ opacity: 1, scale: 1, y: 0 }} |
| 22 | + className="w-full max-w-5xl bg-[#0B0F1A] border border-slate-800 rounded-[40px] shadow-[0_0_100px_rgba(0,0,0,0.8)] overflow-hidden flex flex-col md:flex-row max-h-[90vh]" |
| 23 | + > |
| 24 | + <button onClick={onClose} className="absolute top-8 right-8 text-slate-500 hover:text-white transition-colors"> |
| 25 | + <X className="h-8 w-8" /> |
| 26 | + </button> |
| 27 | + |
| 28 | + {/* Left Side: Review */} |
| 29 | + <div className="flex-1 p-10 md:p-14 overflow-y-auto border-r border-slate-800/50"> |
| 30 | + <h2 className="text-4xl font-bold text-white mb-2 tracking-tight">One-Booking Checkout</h2> |
| 31 | + <p className="text-slate-400 font-medium mb-12">Review your complete Flow and book everything at once.</p> |
| 32 | + |
| 33 | + <div className="space-y-6"> |
| 34 | + {items.map((item, i) => ( |
| 35 | + <div key={i} className="flex items-center justify-between p-6 rounded-3xl bg-slate-900/30 border border-slate-800/30"> |
| 36 | + <div className="flex items-center gap-6"> |
| 37 | + <div className="h-14 w-14 rounded-2xl bg-cyan-500/10 flex items-center justify-center text-cyan-400 border border-cyan-500/20"> |
| 38 | + {item.type === 'flight' && <Plane className="h-6 w-6" />} |
| 39 | + {item.type === 'hotel' && <Hotel className="h-6 w-6" />} |
| 40 | + {item.type === 'activity' && <MapPin className="h-6 w-6" />} |
| 41 | + </div> |
| 42 | + <div> |
| 43 | + <h4 className="font-bold text-white text-xl mb-1">{item.title}</h4> |
| 44 | + <p className="text-sm text-slate-500 font-medium">{item.details}</p> |
| 45 | + </div> |
| 46 | + </div> |
| 47 | + <div className="text-2xl font-bold text-cyan-400 tracking-tight">${item.price}</div> |
| 48 | + </div> |
| 49 | + ))} |
| 50 | + </div> |
| 51 | + </div> |
| 52 | + |
| 53 | + {/* Right Side: Payment */} |
| 54 | + <div className="w-full md:w-[400px] bg-slate-900/20 p-10 md:p-14 flex flex-col justify-between"> |
| 55 | + <div> |
| 56 | + <h3 className="text-xl font-bold text-white mb-8">Summary</h3> |
| 57 | + <div className="space-y-4 mb-8"> |
| 58 | + {items.map((item, i) => ( |
| 59 | + <div key={i} className="flex justify-between text-sm"> |
| 60 | + <span className="text-slate-500 font-medium">{item.title}</span> |
| 61 | + <span className="text-slate-300 font-bold">${item.price}</span> |
| 62 | + </div> |
| 63 | + ))} |
| 64 | + </div> |
| 65 | + <div className="flex justify-between items-center pt-6 border-t border-slate-800 mb-12"> |
| 66 | + <span className="text-lg font-bold text-white">Total</span> |
| 67 | + <span className="text-3xl font-display font-bold text-cyan-400">${total}</span> |
| 68 | + </div> |
| 69 | + |
| 70 | + <h3 className="text-sm font-bold uppercase tracking-widest text-slate-500 mb-6">Payment</h3> |
| 71 | + <div className="space-y-3 mb-10"> |
| 72 | + <div className="flex items-center gap-4 p-5 rounded-2xl border-2 border-cyan-500/50 bg-cyan-500/10 text-white cursor-pointer group"> |
| 73 | + <CreditCard className="h-5 w-5 text-cyan-400" /> |
| 74 | + <span className="font-bold">Card</span> |
| 75 | + </div> |
| 76 | + <div className="flex items-center gap-4 p-5 rounded-2xl border border-slate-800 bg-slate-900/50 text-slate-500 cursor-not-allowed opacity-50"> |
| 77 | + <Wallet className="h-5 w-5" /> |
| 78 | + <span className="font-bold">MiniPay</span> |
| 79 | + </div> |
| 80 | + </div> |
| 81 | + </div> |
| 82 | + |
| 83 | + <button |
| 84 | + onClick={onConfirm} |
| 85 | + className="w-full bg-cyan-500 text-slate-900 py-6 rounded-[22px] font-black text-lg shadow-2xl shadow-cyan-500/20 hover:bg-cyan-400 hover:scale-[1.01] transition-all active:scale-[0.98]" |
| 86 | + > |
| 87 | + Confirm & Book — ${total} |
| 88 | + </button> |
| 89 | + </div> |
| 90 | + </motion.div> |
| 91 | + </motion.div> |
| 92 | + ); |
| 93 | +}; |
0 commit comments