File size: 861 Bytes
4b70bdc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
class CustomSidebar extends HTMLElement {
  connectedCallback() {
    this.attachShadow({ mode: 'open' });
    this.shadowRoot.innerHTML = `
      <style>
        aside {
          width: 250px;
          background: #f7fafc;
          padding: 1rem;
          height: 100vh;
          position: fixed;
          left: 0;
          top: 0;
          border-right: 1px solid #e5e7eb;
        }
        h3 { margin: 0 0 1rem 0; }
        ul { list-style: none; padding: 0; margin: 0; }
        li { margin: 0.5rem 0; }
        a { color: #374151; text-decoration: none; }
        a:hover { color: #667eea; }
      </style>
      <aside>
        <h3>Sidebar</h3>
        <ul>
          <li><a href="/">Home</a></li>
          <li><a href="/about.html">About</a></li>
        </ul>
      </aside>
    `;
  }
}
customElements.define('custom-sidebar', CustomSidebar);