Spaces:
Running
Running
File size: 2,575 Bytes
58d09df | 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 | class CustomSidebar extends HTMLElement {
connectedCallback() {
this.attachShadow({ mode: 'open' });
this.shadowRoot.innerHTML = `
<style>
:host {
display: block;
width: 280px;
background-color: #ffffff;
border-right: 1px solid #e2e8f0;
height: 100vh;
padding: 1.5rem;
}
.sidebar-header {
margin-bottom: 2rem;
}
.logo {
font-size: 1.5rem;
font-weight: 600;
color: #5aa58b;
margin-bottom: 1rem;
font-family: 'Inter', sans-serif;
}
.new-btn {
width: 100%;
padding: 0.75rem;
background-color: #8bd8bd;
color: white;
border: none;
border-radius: 8px;
font-weight: 500;
cursor: pointer;
transition: all 0.2s;
font-family: 'Inter', sans-serif;
}
.new-btn:hover {
background-color: #5aa58b;
}
nav ul {
list-style: none;
}
nav li {
margin-bottom: 0.5rem;
}
nav a {
display: flex;
align-items: center;
padding: 0.75rem;
border-radius: 8px;
color: #4a5568;
text-decoration: none;
transition: all 0.2s;
font-family: 'Inter', sans-serif;
}
nav a:hover {
background-color: #c0f0e2;
color: #5aa58b;
}
.active a {
background-color: #c0f0e2;
color: #5aa58b;
font-weight: 500;
}
.icon {
margin-right: 0.75rem;
font-size: 1.1rem;
}
</style>
<div class="sidebar-header">
<div class="logo">MindFlow</div>
<button class="new-btn">+ New</button>
</div>
<nav>
<ul>
<li class="active"><a href="#"><span class="icon">π</span> Notes</a></li>
<li><a href="#"><span class="icon">π</span> Trackers</a></li>
<li><a href="#"><span class="icon">ποΈ</span> Databases</a></li>
<li><a href="#"><span class="icon">βοΈ</span> Settings</a></li>
</ul>
</nav>
`;
// Add event listeners
this.shadowRoot.querySelector('.new-btn').addEventListener('click', () => {
this.dispatchEvent(new CustomEvent('new-note'));
});
}
}
customElements.define('custom-sidebar', CustomSidebar); |