File size: 2,537 Bytes
7ca8a68 | 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 | class CustomNotesSidebar extends HTMLElement {
connectedCallback() {
this.attachShadow({ mode: 'open' });
this.shadowRoot.innerHTML = `
<style>
:host {
display: block;
width: 280px;
background: white;
height: calc(100vh - 80px);
position: sticky;
top: 80px;
border-right: 1px solid #e5e7eb;
padding: 1.5rem;
}
h3 {
font-size: 1.25rem;
font-weight: 600;
margin-bottom: 1rem;
color: #1f2937;
}
ul {
list-style: none;
padding: 0;
margin: 0;
}
li {
margin-bottom: 0.5rem;
}
a {
display: flex;
align-items: center;
padding: 0.5rem 1rem;
border-radius: 0.375rem;
color: #4b5563;
text-decoration: none;
transition: all 0.2s;
}
a:hover {
background: #f3f4f6;
color: #1f2937;
}
a.active {
background: #e0e7ff;
color: #4338ca;
}
i {
margin-right: 0.75rem;
width: 20px;
height: 20px;
}
.category-header {
font-size: 0.875rem;
font-weight: 500;
color: #6b7280;
margin: 1.5rem 0 0.5rem 0;
padding-left: 1rem;
}
</style>
<div>
<h3>My Notebooks</h3>
<ul>
<li><a href="/notes.html" class="active"><i data-feather="book"></i> All Notes</a></li>
<li><a href="#"><i data-feather="star"></i> Favorites</a></li>
<li><a href="#"><i data-feather="archive"></i> Archived</a></li>
</ul>
<div class="category-header">Categories</div>
<ul>
<li><a href="#"><i data-feather="code"></i> JavaScript</a></li>
<li><a href="#"><i data-feather="cpu"></i> Algorithms</a></li>
<li><a href="#"><i data-feather="database"></i> Databases</a></li>
<li><a href="#"><i data-feather="layout"></i> UI/UX</a></li>
</ul>
<div class="category-header">Tags</div>
<ul>
<li><a href="#"><i data-feather="tag"></i> Important</a></li>
<li><a href="#"><i data-feather="tag"></i> Tutorial</a></li>
<li><a href="#"><i data-feather="tag"></i> Reference</a></li>
</ul>
</div>
`;
feather.replace();
}
}
customElements.define('custom-notes-sidebar', CustomNotesSidebar); |