Spaces:
Running
Running
| 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); |