File size: 2,003 Bytes
7fa209a 33b5019 7fa209a 33b5019 2a1f177 7fa209a 33b5019 7fa209a 33b5019 7fa209a 33b5019 7fa209a 33b5019 7fa209a 6110ac3 7fa209a 33b5019 7fa209a |
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 |
class CustomNavbar extends HTMLElement {
connectedCallback() {
this.attachShadow({ mode: 'open' });
this.shadowRoot.innerHTML = `
<style>
nav {
background: linear-gradient(90deg, #4f46e5, #7c3aed);
color: white;
padding: 1rem 2rem;
display: flex;
justify-content: space-between;
align-items: center;
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
position: sticky;
top: 0;
z-index: 1000;
}
.logo {
display: flex;
align-items: center;
font-weight: bold;
font-size: 1.5rem;
gap: 10px;
}
.logo img {
height: 40px;
}
.nav-links {
display: flex;
gap: 20px;
}
.nav-links a {
color: white;
text-decoration: none;
padding: 0.5rem 1rem;
border-radius: 8px;
transition: background 0.3s;
}
.nav-links a:hover {
background: rgba(255,255,255,0.2);
}
.nav-links a.active {
background: rgba(255,255,255,0.3);
}
@media (max-width: 768px) {
nav {
flex-direction: column;
padding: 1rem;
}
.nav-links {
margin-top: 1rem;
width: 100%;
justify-content: space-around;
}
}
</style>
<nav>
<div class="logo">
<i class="fas fa-graduation-cap" style="font-size: 2rem;"></i>
<span>StudyMate</span>
</div>
<div class="nav-links">
<a href="/" class="active">ืืืช</a>
<a href="/materials.html">ืืืืจืื</a>
<a href="/grades.html">ืฆืืื ืื</a>
<a href="/profile.html">ืคืจืืคืื</a>
</div>
</nav>
`;
}
}
customElements.define('custom-navbar', CustomNavbar); |