|
1 | 1 | import { useEffect, useState } from 'react'; |
2 | 2 | import { NavLink } from 'react-router-dom'; |
| 3 | +import { AnimatePresence, motion } from 'framer-motion'; |
3 | 4 | import { signOut } from 'firebase/auth'; |
4 | 5 | import { auth } from '../lib/firebase'; |
5 | 6 | import { useAuth } from '../context/AuthContext'; |
@@ -92,25 +93,33 @@ export default function Header() { |
92 | 93 | {avatar} |
93 | 94 | <i className={`fa-solid ${profileOpen ? 'fa-chevron-up' : 'fa-chevron-down'} text-xs text-white/70`} /> |
94 | 95 | </button> |
95 | | - {profileOpen && ( |
96 | | - <div className="absolute right-0 mt-2 w-56 rounded-2xl border border-white/10 bg-slate-900/95 p-4 text-sm text-white shadow-lg"> |
97 | | - <p className="truncate text-xs text-slate-300">{user.email}</p> |
98 | | - <NavLink |
99 | | - to="/apps" |
100 | | - className="mt-3 block rounded-full border border-white/15 px-3 py-2 text-center font-semibold hover:border-sky-400" |
101 | | - onClick={() => setProfileOpen(false)} |
| 96 | + <AnimatePresence> |
| 97 | + {profileOpen && ( |
| 98 | + <motion.div |
| 99 | + initial={{ opacity: 0, y: -6, scale: 0.98 }} |
| 100 | + animate={{ opacity: 1, y: 0, scale: 1 }} |
| 101 | + exit={{ opacity: 0, y: -6, scale: 0.98 }} |
| 102 | + transition={{ duration: 0.18, ease: [0.4, 0, 0.2, 1] }} |
| 103 | + className="absolute right-0 mt-2 w-56 rounded-2xl border border-white/10 bg-slate-900/95 p-4 text-sm text-white shadow-lg" |
102 | 104 | > |
103 | | - Apps dashboard |
104 | | - </NavLink> |
105 | | - <button |
106 | | - type="button" |
107 | | - className="mt-2 w-full rounded-full bg-slate-800 px-3 py-2 font-semibold hover:bg-slate-700" |
108 | | - onClick={handleSignOut} |
109 | | - > |
110 | | - Sign out |
111 | | - </button> |
112 | | - </div> |
113 | | - )} |
| 105 | + <p className="truncate text-xs text-slate-300">{user.email}</p> |
| 106 | + <NavLink |
| 107 | + to="/apps" |
| 108 | + className="mt-3 block rounded-full border border-white/15 px-3 py-2 text-center font-semibold hover:border-sky-400" |
| 109 | + onClick={() => setProfileOpen(false)} |
| 110 | + > |
| 111 | + Apps dashboard |
| 112 | + </NavLink> |
| 113 | + <button |
| 114 | + type="button" |
| 115 | + className="mt-2 w-full rounded-full bg-slate-800 px-3 py-2 font-semibold hover:bg-slate-700" |
| 116 | + onClick={handleSignOut} |
| 117 | + > |
| 118 | + Sign out |
| 119 | + </button> |
| 120 | + </motion.div> |
| 121 | + )} |
| 122 | + </AnimatePresence> |
114 | 123 | </div> |
115 | 124 | </> |
116 | 125 | )} |
|
0 commit comments