Spaces:
Running
Running
File size: 14,186 Bytes
cfe806b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Notification Header</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
.notification-badge {
position: absolute;
top: -5px;
right: -5px;
min-width: 20px;
height: 20px;
border-radius: 10px;
display: flex;
align-items: center;
justify-content: center;
animation: pulse 2s infinite;
}
@keyframes pulse {
0% {
transform: scale(1);
}
50% {
transform: scale(1.1);
}
100% {
transform: scale(1);
}
}
.notification-dropdown {
max-height: 0;
overflow: hidden;
transition: max-height 0.3s ease-out;
}
.notification-dropdown.open {
max-height: 500px;
transition: max-height 0.3s ease-in;
}
.notification-item.unread {
background-color: #f0f9ff;
border-left: 3px solid #3b82f6;
}
.notification-item:hover {
background-color: #f8fafc;
}
</style>
</head>
<body class="bg-gray-50">
<header class="bg-white shadow-sm">
<div class="max-w-7xl mx-auto px-4 py-4 sm:px-6 lg:px-8 flex justify-between items-center">
<div class="flex items-center">
<h1 class="text-xl font-bold text-gray-900">My App</h1>
</div>
<div class="flex items-center space-x-4">
<!-- Notification Button -->
<div class="relative">
<button id="notification-btn" class="p-2 rounded-full text-gray-600 hover:text-gray-900 hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500">
<i class="fas fa-bell text-xl"></i>
<span id="notification-count" class="notification-badge bg-red-500 text-white text-xs font-bold px-1.5">5</span>
</button>
<!-- Notification Dropdown -->
<div id="notification-dropdown" class="notification-dropdown absolute right-0 mt-2 w-80 bg-white rounded-md shadow-lg overflow-hidden z-10">
<div class="border-b border-gray-200 px-4 py-3 flex justify-between items-center">
<h3 class="text-lg font-medium text-gray-900">Notifications</h3>
<a href="#" class="text-sm text-blue-600 hover:text-blue-800">View All</a>
</div>
<div class="divide-y divide-gray-200 max-h-96 overflow-y-auto">
<!-- Notification Items -->
<div class="notification-item unread px-4 py-3">
<div class="flex justify-between items-start">
<div>
<p class="font-medium text-gray-900">New Message</p>
<p class="text-sm text-gray-600">You have received a new message from John Doe</p>
<p class="text-xs text-gray-500 mt-1">2 minutes ago</p>
</div>
<button class="text-gray-400 hover:text-gray-600">
<i class="fas fa-times"></i>
</button>
</div>
</div>
<div class="notification-item unread px-4 py-3">
<div class="flex justify-between items-start">
<div>
<p class="font-medium text-gray-900">System Update</p>
<p class="text-sm text-gray-600">A new version of the app is available</p>
<p class="text-xs text-gray-500 mt-1">15 minutes ago</p>
</div>
<button class="text-gray-400 hover:text-gray-600">
<i class="fas fa-times"></i>
</button>
</div>
</div>
<div class="notification-item px-4 py-3">
<div class="flex justify-between items-start">
<div>
<p class="font-medium text-gray-900">Payment Received</p>
<p class="text-sm text-gray-600">Your payment of $29.99 has been processed</p>
<p class="text-xs text-gray-500 mt-1">1 hour ago</p>
</div>
<button class="text-gray-400 hover:text-gray-600">
<i class="fas fa-times"></i>
</button>
</div>
</div>
<div class="notification-item px-4 py-3">
<div class="flex justify-between items-start">
<div>
<p class="font-medium text-gray-900">New Follower</p>
<p class="text-sm text-gray-600">Sarah Johnson started following you</p>
<p class="text-xs text-gray-500 mt-1">3 hours ago</p>
</div>
<button class="text-gray-400 hover:text-gray-600">
<i class="fas fa-times"></i>
</button>
</div>
</div>
<div class="notification-item px-4 py-3">
<div class="flex justify-between items-start">
<div>
<p class="font-medium text-gray-900">Event Reminder</p>
<p class="text-sm text-gray-600">Your meeting starts in 30 minutes</p>
<p class="text-xs text-gray-500 mt-1">5 hours ago</p>
</div>
<button class="text-gray-400 hover:text-gray-600">
<i class="fas fa-times"></i>
</button>
</div>
</div>
<div class="notification-item px-4 py-3">
<div class="flex justify-between items-start">
<div>
<p class="font-medium text-gray-900">New Comment</p>
<p class="text-sm text-gray-600">Alex commented on your post</p>
<p class="text-xs text-gray-500 mt-1">1 day ago</p>
</div>
<button class="text-gray-400 hover:text-gray-600">
<i class="fas fa-times"></i>
</button>
</div>
</div>
<div class="notification-item px-4 py-3">
<div class="flex justify-between items-start">
<div>
<p class="font-medium text-gray-900">Account Activity</p>
<p class="text-sm text-gray-600">New login from Chrome on Windows</p>
<p class="text-xs text-gray-500 mt-1">2 days ago</p>
</div>
<button class="text-gray-400 hover:text-gray-600">
<i class="fas fa-times"></i>
</button>
</div>
</div>
<div class="notification-item px-4 py-3">
<div class="flex justify-between items-start">
<div>
<p class="font-medium text-gray-900">Weekly Report</p>
<p class="text-sm text-gray-600">Your weekly activity report is ready</p>
<p class="text-xs text-gray-500 mt-1">3 days ago</p>
</div>
<button class="text-gray-400 hover:text-gray-600">
<i class="fas fa-times"></i>
</button>
</div>
</div>
</div>
<div class="bg-gray-50 px-4 py-3 text-center">
<a href="#" class="text-sm font-medium text-blue-600 hover:text-blue-800">Mark all as read</a>
</div>
</div>
</div>
<!-- User Profile -->
<div class="relative">
<button class="flex items-center space-x-2 focus:outline-none">
<img class="h-8 w-8 rounded-full" src="https://images.unsplash.com/photo-1472099645785-5658abf4ff4e?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=facearea&facepad=2&w=256&h=256&q=80" alt="">
<span class="text-gray-700">John Doe</span>
</button>
</div>
</div>
</div>
</header>
<main class="max-w-7xl mx-auto px-4 py-8 sm:px-6 lg:px-8">
<h2 class="text-2xl font-bold text-gray-900 mb-6">Dashboard</h2>
<div class="bg-white shadow rounded-lg p-6">
<p class="text-gray-700">Welcome to your dashboard. Here you can see your recent activity and notifications.</p>
</div>
</main>
<script>
document.addEventListener('DOMContentLoaded', function() {
const notificationBtn = document.getElementById('notification-btn');
const notificationDropdown = document.getElementById('notification-dropdown');
const notificationCount = document.getElementById('notification-count');
let isOpen = false;
let unreadCount = 2; // Initial unread count based on the sample data
// Toggle notification dropdown
notificationBtn.addEventListener('click', function(e) {
e.stopPropagation();
isOpen = !isOpen;
if (isOpen) {
notificationDropdown.classList.add('open');
// Mark notifications as read when opened
unreadCount = 0;
updateNotificationCount();
} else {
notificationDropdown.classList.remove('open');
}
});
// Close dropdown when clicking outside
document.addEventListener('click', function() {
if (isOpen) {
notificationDropdown.classList.remove('open');
isOpen = false;
}
});
// Prevent dropdown from closing when clicking inside
notificationDropdown.addEventListener('click', function(e) {
e.stopPropagation();
});
// Delete notification
document.querySelectorAll('.notification-item button').forEach(button => {
button.addEventListener('click', function(e) {
e.stopPropagation();
this.closest('.notification-item').remove();
});
});
// Update notification count
function updateNotificationCount() {
if (unreadCount > 0) {
notificationCount.textContent = unreadCount;
notificationCount.classList.remove('hidden');
} else {
notificationCount.classList.add('hidden');
}
}
// Initial update
updateNotificationCount();
});
</script>
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=LoicUX/notification" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html> |