File size: 4,730 Bytes
4d45ff8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
class CustomSidebar extends HTMLElement {
    connectedCallback() {
        this.attachShadow({ mode: 'open' });
        const path = this.getAttribute('path') || '';
        this.shadowRoot.innerHTML = `
            <style>
                :host {
                    display: block;
                    width: 250px;
                }
                
                aside {
                    background: white;
                    border-radius: 0.75rem;
                    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
                    padding: 1rem;
                    position: sticky;
                    top: 1rem;
                }
                
                h3 {
                    font-size: 1rem;
                    font-weight: 600;
                    color: #1e293b;
                    margin-bottom: 1rem;
                    padding-bottom: 0.5rem;
                    border-bottom: 1px solid #e2e8f0;
                }
                
                ul {
                    list-style: none;
                    padding: 0;
                    margin: 0;
                }
                
                li {
                    margin-bottom: 0.5rem;
                }
                
                a {
                    display: flex;
                    align-items: center;
                    padding: 0.5rem;
                    border-radius: 0.375rem;
                    color: #64748b;
                    text-decoration: none;
                    font-size: 0.875rem;
                    font-weight: 500;
                    transition: all 0.2s;
                }
                
                a:hover {
                    color: #2563eb;
                    background-color: #eff6ff;
                }
                
                a.active {
                    color: #2563eb;
                    background-color: #eff6ff;
                    font-weight: 600;
                }
                
                i {
                    margin-right: 0.75rem;
                    width: 16px;
                    height: 16px;
                }
                
                .divider {
                    height: 1px;
                    background-color: #e2e8f0;
                    margin: 1rem 0;
                }
                
                @media (max-width: 768px) {
                    :host {
                        width: 100%;
                        margin-bottom: 1rem;
                    }
                    
                    aside {
                        position: static;
                    }
                }
            </style>
            <aside>
                <h3>Learning Path</h3>
                <ul>
                    <li>
                        <a href="/beginner.html" class="${path === 'beginner' ? 'active' : ''}">
                            <i data-feather="book"></i>
                            Beginner
                        </a>
                    </li>
                    <li>
                        <a href="/intermediate.html" class="${path === 'intermediate' ? 'active' : ''}">
                            <i data-feather="code"></i>
                            Intermediate
                        </a>
                    </li>
                    <li>
                        <a href="/advanced.html" class="${path === 'advanced' ? 'active' : ''}">
                            <i data-feather="zap"></i>
                            Advanced
                        </a>
                    </li>
                </ul>
                
                <div class="divider"></div>
                
                <h3>Resources</h3>
                <ul>
                    <li>
                        <a href="#">
                            <i data-feather="file-text"></i>
                            Cheat Sheets
                        </a>
                    </li>
                    <li>
                        <a href="#">
                            <i data-feather="help-circle"></i>
                            FAQ
                        </a>
                    </li>
                    <li>
                        <a href="#">
                            <i data-feather="message-square"></i>
                            Community
                        </a>
                    </li>
                </ul>
            </aside>
        `;
        
        // Replace feather icons after render
        setTimeout(() => {
            const icons = this.shadowRoot.querySelectorAll('[data-feather]');
            icons.forEach(icon => {
                feather.replace(icon);
            });
        }, 100);
    }
}

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