|
| 1 | +import React, { useState } from "react"; |
| 2 | +import { motion, AnimatePresence } from "framer-motion"; |
| 3 | + |
| 4 | +export function HeadingBanner() { |
| 5 | + const [isVisible, setIsVisible] = useState(true); |
| 6 | + |
| 7 | + if (!isVisible) { |
| 8 | + return null; |
| 9 | + } |
| 10 | + |
| 11 | + return ( |
| 12 | + <AnimatePresence> |
| 13 | + <motion.div |
| 14 | + initial={{ y: -100, opacity: 0 }} |
| 15 | + animate={{ y: 0, opacity: 1 }} |
| 16 | + exit={{ y: -100, opacity: 0 }} |
| 17 | + transition={{ duration: 0.3, ease: "easeOut" }} |
| 18 | + className="fixed top-16 left-0 right-0 z-40 bg-gradient-to-r from-blue-600 to-blue-800 text-white shadow-lg border-b border-blue-500 rounded-xl" |
| 19 | + > |
| 20 | + <div className="max-w-7xl mx-auto px-4 py-3 flex items-center justify-between"> |
| 21 | + <div className="flex items-center flex-col flex-1"> |
| 22 | + <div className="flex items-center gap-2"> |
| 23 | + <motion.div |
| 24 | + animate={{ scale: [1, 1.1, 1] }} |
| 25 | + transition={{ duration: 2, repeat: Infinity, ease: "easeInOut" }} |
| 26 | + className="text-yellow-300" |
| 27 | + > |
| 28 | + 📢 |
| 29 | + </motion.div> |
| 30 | + <span className="font-bold text-lg">Tryouts Announcement!</span> |
| 31 | + </div> |
| 32 | + <div className="flex flex-col sm:flex-row sm:items-center sm:justify-center gap-1 sm:gap-4 text-center"> |
| 33 | + <span className="text-sm sm:text-base"> |
| 34 | + Join the TechKnights! Tryouts are happening now. |
| 35 | + </span> |
| 36 | + <a |
| 37 | + href="https://docs.google.com/forms/d/e/1FAIpQLSfD1IV7jSP3xN7ICn42X0ZvbHa3hUnmJzX0H7mQ1TH--LO_jA/viewform" |
| 38 | + className="inline-flex items-center gap-1 bg-white text-blue-600 px-3 py-1 rounded-full text-sm font-semibold hover:bg-blue-50 transition-colors" |
| 39 | + > |
| 40 | + Learn More → |
| 41 | + </a> |
| 42 | + </div> |
| 43 | + </div> |
| 44 | + |
| 45 | + <button |
| 46 | + onClick={() => setIsVisible(false)} |
| 47 | + className="ml-4 p-1 hover:bg-blue-700 rounded-full transition-colors flex-shrink-0" |
| 48 | + aria-label="Close announcement" |
| 49 | + > |
| 50 | + <svg |
| 51 | + className="w-5 h-5" |
| 52 | + fill="none" |
| 53 | + stroke="currentColor" |
| 54 | + viewBox="0 0 24 24" |
| 55 | + > |
| 56 | + <path |
| 57 | + strokeLinecap="round" |
| 58 | + strokeLinejoin="round" |
| 59 | + strokeWidth={2} |
| 60 | + d="M6 18L18 6M6 6l12 12" |
| 61 | + /> |
| 62 | + </svg> |
| 63 | + </button> |
| 64 | + </div> |
| 65 | + </motion.div> |
| 66 | + </AnimatePresence> |
| 67 | + ); |
| 68 | +} |
0 commit comments