import React, { useState, useEffect, useRef } from 'react'; import { createRoot } from 'react-dom/client'; import { Calendar, MapPin, Heart, MessageCircle, Copy, Check, Music, Music2, Clock, ChevronDown } from 'lucide-react'; // --- Components --- const Countdown = ({ targetDate }: { targetDate: Date }) => { const [timeLeft, setTimeLeft] = useState({ days: 0, hours: 0, minutes: 0, seconds: 0 }); useEffect(() => { const timer = setInterval(() => { const now = new Date().getTime(); const difference = targetDate.getTime() - now; if (difference > 0) { setTimeLeft({ days: Math.floor(difference / (1000 * 60 * 60 * 24)), hours: Math.floor((difference / (1000 * 60 * 60)) % 24), minutes: Math.floor((difference / 1000 / 60) % 60), seconds: Math.floor((difference / 1000) % 60) }); } }, 1000); return () => clearInterval(timer); }, [targetDate]); return (
{[ { label: 'Hari', value: timeLeft.days }, { label: 'Jam', value: timeLeft.hours }, { label: 'Menit', value: timeLeft.minutes }, { label: 'Detik', value: timeLeft.seconds } ].map((item, idx) => (
{item.value}
{item.label}
))}
); }; const App = () => { const [isOpen, setIsOpen] = useState(false); const [isPlaying, setIsPlaying] = useState(false); const [copied, setCopied] = useState(null); const audioRef = useRef(null); const targetDate = new Date('2025-12-29T09:00:00'); const toggleMusic = () => { if (audioRef.current) { if (isPlaying) audioRef.current.pause(); else audioRef.current.play(); setIsPlaying(!isPlaying); } }; const handleCopy = (text: string) => { navigator.clipboard.writeText(text); setCopied(text); setTimeout(() => setCopied(null), 2000); }; const handleOpen = () => { setIsOpen(true); setIsPlaying(true); if (audioRef.current) audioRef.current.play(); }; if (!isOpen) { return (
Cover

Undangan Pernikahan

Ahmad & Anisah

); } return (
); }; const root = createRoot(document.getElementById('root')!); root.render();