|
| 1 | +'use client'; |
| 2 | +import React, { useState } from 'react'; |
| 3 | + |
| 4 | +export default function MyCustomButtonV4({ children = '✨ ZEPHYRA ✨', onClick }) { |
| 5 | + const [hovered, setHovered] = useState(false); |
| 6 | + const [pressed, setPressed] = useState(false); |
| 7 | + |
| 8 | + const handleClick = (e) => { |
| 9 | + setPressed(true); |
| 10 | + setTimeout(() => setPressed(false), 150); |
| 11 | + if (onClick) onClick(e); |
| 12 | + }; |
| 13 | + |
| 14 | + return ( |
| 15 | + <button |
| 16 | + onClick={handleClick} |
| 17 | + onMouseEnter={() => setHovered(true)} |
| 18 | + onMouseLeave={() => setHovered(false)} |
| 19 | + className={`relative px-12 py-5 font-bold text-white text-xl rounded-3xl transition-transform duration-200 |
| 20 | + ${hovered ? 'scale-105 shadow-2xl' : 'shadow-lg'} |
| 21 | + ${pressed ? 'scale-95' : ''} |
| 22 | + `} |
| 23 | + style={{ |
| 24 | + backgroundImage: hovered |
| 25 | + ? 'linear-gradient(270deg, #ff6fcf, #6a0dad, #00f0ff, #ff6fcf)' |
| 26 | + : 'linear-gradient(270deg, #6a0dad, #ff6fcf, #00f0ff, #6a0dad)', |
| 27 | + backgroundRepeat: 'no-repeat', |
| 28 | + backgroundSize: '600% 600%', |
| 29 | + animation: 'gradientMove 5s ease infinite', |
| 30 | + boxShadow: hovered |
| 31 | + ? '0 10px 30px rgba(255,111,207,0.7), 0 0 20px rgba(0,240,255,0.7)' |
| 32 | + : '0 6px 15px rgba(106,13,173,0.5)', |
| 33 | + textShadow: '0 0 10px rgba(255,255,255,0.7)', |
| 34 | +}} |
| 35 | + |
| 36 | + > |
| 37 | + <span className="relative z-10 flex items-center gap-2 justify-center"> |
| 38 | + <span className="animate-pulse">🚀</span> |
| 39 | + {children} |
| 40 | + <span className={`inline-block transition-opacity ${hovered ? 'opacity-100 animate-ping' : 'opacity-0'}`}>✨</span> |
| 41 | + </span> |
| 42 | + |
| 43 | + {/* Glow */} |
| 44 | + <div |
| 45 | + className="absolute inset-0 rounded-3xl opacity-0 transition-opacity duration-300" |
| 46 | + style={{ |
| 47 | + background: 'radial-gradient(circle, rgba(255,111,207,0.5) 0%, transparent 70%)', |
| 48 | + opacity: hovered ? 1 : 0, |
| 49 | + }} |
| 50 | + /> |
| 51 | + |
| 52 | + {/* Sparkle lines */} |
| 53 | + {[...Array(3)].map((_, i) => ( |
| 54 | + <div |
| 55 | + key={i} |
| 56 | + className="absolute h-px bg-white opacity-40" |
| 57 | + style={{ |
| 58 | + width: '100%', |
| 59 | + top: `${25 + i * 25}%`, |
| 60 | + left: 0, |
| 61 | + animation: `sparkMove 2s linear infinite`, |
| 62 | + animationDelay: `${i * 0.2}s`, |
| 63 | + }} |
| 64 | + /> |
| 65 | + ))} |
| 66 | + |
| 67 | + <style jsx>{` |
| 68 | + @keyframes gradientMove { |
| 69 | + 0% { background-position: 0% 50%; } |
| 70 | + 50% { background-position: 100% 50%; } |
| 71 | + 100% { background-position: 0% 50%; } |
| 72 | + } |
| 73 | + @keyframes sparkMove { |
| 74 | + 0% { transform: translateX(-100%); opacity: 0; } |
| 75 | + 50% { opacity: 0.5; } |
| 76 | + 100% { transform: translateX(100%); opacity: 0; } |
| 77 | + } |
| 78 | + `}</style> |
| 79 | + </button> |
| 80 | + ); |
| 81 | +} |
0 commit comments