File size: 1,599 Bytes
3d6e1be
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
class CustomSidebar extends HTMLElement {
    connectedCallback() {
        this.attachShadow({ mode: 'open' });
        this.shadowRoot.innerHTML = `
            <style>
                :host {
                    display: block;
                }
                aside {
                    position: sticky;
                    top: 2rem;
                }
                h3 {
                    font-weight: 600;
                    color: #1f2937;
                    margin-bottom: 1rem;
                }
                ul {
                    list-style: none;
                    padding: 0;
                    margin: 0;
                }
                li {
                    margin-bottom: 0.75rem;
                }
                a {
                    display: flex;
                    align-items: center;
                    justify-content: space-between;
                    padding: 0.5rem 0;
                    text-decoration: none;
                    transition: color 0.2s;
                }
                .tag {
                    display: inline-block;
                    padding: 0.25rem 0.5rem;
                    border-radius: 9999px;
                    font-size: 0.75rem;
                    line-height: 1rem;
                }
                .flex-wrap {
                    display: flex;
                    flex-wrap: wrap;
                    gap: 0.5rem;
                }
            </style>
            <aside>
                <slot></slot>
            </aside>
        `;
    }
}

customElements.define('custom-sidebar', CustomSidebar);