Spaces:
Running
Running
File size: 4,070 Bytes
52e816d b0d5524 52e816d b0d5524 52e816d b0d5524 52e816d bad53f2 52e816d bad53f2 52e816d bad53f2 52e816d bad53f2 52e816d | 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 | class CustomHeader extends HTMLElement {
connectedCallback() {
this.attachShadow({ mode: 'open' });
this.shadowRoot.innerHTML = `
<style>
.header {
height: 64px;
background: rgba(255, 255, 255, 0.95);
backdrop-filter: blur(10px);
border-bottom: 1px solid rgba(229, 231, 235, 0.5);
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 24px;
position: sticky;
top: 0;
z-index: 20;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}
.search-bar {
flex: 1;
max-width: 500px;
margin: 0 24px;
}
.search-input {
width: 100%;
padding: 8px 16px;
border-radius: 6px;
border: 1px solid #e5e7eb;
background-color: #f9fafb;
transition: all 0.2s;
}
.search-input:focus {
outline: none;
border-color: #a5b4fc;
background-color: white;
box-shadow: 0 0 0 3px rgba(199, 210, 254, 0.5);
}
.header-actions {
display: flex;
align-items: center;
}
.action-btn {
width: 36px;
height: 36px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
margin-left: 12px;
color: #4b5563;
background: none;
border: none;
cursor: pointer;
transition: all 0.2s;
}
.action-btn:hover {
background-color: #f3f4f6;
color: #111827;
}
.notification-badge {
position: absolute;
top: -2px;
right: -2px;
width: 16px;
height: 16px;
background-color: #ef4444;
color: white;
border-radius: 50%;
font-size: 10px;
display: flex;
align-items: center;
justify-content: center;
}
.user-menu {
position: relative;
margin-left: 16px;
}
.user-avatar {
width: 36px;
height: 36px;
border-radius: 50%;
background-color: #e5e7eb;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
overflow: hidden;
}
@media (max-width: 768px) {
.search-bar {
display: none;
}
.header {
padding: 0 16px;
}
}
</style>
<header class="header">
<div class="flex items-center">
<button class="action-btn md:hidden">
<i class="fas fa-bars"></i>
</button>
<h1 class="text-xl font-bold ml-4 hidden md:block">EduPulse</h1>
</div>
<div class="search-bar">
<input type="text" class="search-input" placeholder="Search resources, projects...">
</div>
<div class="header-actions">
<button class="action-btn relative">
<i class="fas fa-bell"></i>
<span class="notification-badge">3</span>
</button>
<button id="dark-mode-toggle" class="action-btn">
<i class="fas fa-moon"></i>
</button>
<button class="action-btn">
<i class="fas fa-question-circle"></i>
</button>
<div class="user-menu">
<div class="user-avatar">
<i class="fas fa-user"></i>
</div>
</div>
</div>
</header>
`;
// Mobile menu toggle functionality
this.shadowRoot.querySelector('.action-btn').addEventListener('click', () => {
const sidebar = document.querySelector('custom-sidebar').shadowRoot.querySelector('.sidebar');
sidebar.classList.toggle('collapsed');
});
}
}
customElements.define('custom-header', CustomHeader); |