File size: 6,828 Bytes
fee3420
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d00bc1e
fee3420
 
 
d00bc1e
fee3420
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d00bc1e
fee3420
d00bc1e
 
 
fee3420
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
class CustomSidebar extends HTMLElement {
    connectedCallback() {
        this.attachShadow({ mode: 'open' });
        this.shadowRoot.innerHTML = `
            <style>
                .nav-item {
                    transition: all 0.2s ease;
                }
                
                .nav-item:hover:not(.active) {
                    background-color: rgba(99, 102, 241, 0.1);
                }
                
                .nav-item.active {
                    background-color: rgba(99, 102, 241, 0.2);
                    border-left: 3px solid var(--primary-500);
                }
                
                .submenu {
                    max-height: 0;
                    overflow: hidden;
                    transition: max-height 0.3s ease-out;
                }
                
                .submenu.open {
                    max-height: 500px;
                }
                
                .rotate-90 {
                    transform: rotate(90deg);
                }
            </style>
            <div class="hidden md:flex md:flex-shrink-0">
                <div class="flex flex-col w-64 border-r border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800 h-screen fixed">
                    <div class="h-0 flex-1 flex flex-col pt-5 pb-4 overflow-y-auto">
                        <div class="flex-1 px-3 space-y-1">
                            <a href="index.html" class="nav-item flex items-center px-2 py-3 text-sm font-medium rounded-md text-gray-900 dark:text-white">
                                <i data-feather="home" class="mr-3 h-5 w-5"></i>
                                Dashboard
                            </a>
<div class="space-y-1">
                                <button class="nav-item flex items-center w-full px-2 py-3 text-sm font-medium rounded-md text-gray-900 dark:text-white">
                                    <i data-feather="users" class="mr-3 h-5 w-5"></i>
                                    <span class="flex-1 text-left">Users</span>
                                    <i data-feather="chevron-down" class="h-4 w-4"></i>
                                </button>
                                <div class="submenu pl-11">
                                    <a href="#" class="flex items-center px-2 py-2 text-sm font-medium rounded-md text-gray-600 dark:text-gray-300 hover:text-gray-900 dark:hover:text-white">
                                        All Users
                                    </a>
                                    <a href="#" class="flex items-center px-2 py-2 text-sm font-medium rounded-md text-gray-600 dark:text-gray-300 hover:text-gray-900 dark:hover:text-white">
                                        Add New
                                    </a>
                                </div>
                            </div>
                            
                            <div class="space-y-1">
                                <a href="courses.html" class="nav-item flex items-center px-2 py-3 text-sm font-medium rounded-md text-gray-900 dark:text-white">
                                    <i data-feather="book" class="mr-3 h-5 w-5"></i>
                                    <span class="flex-1">Courses</span>
                                </a>
<div class="submenu pl-11">
                                    <a href="#" class="flex items-center px-2 py-2 text-sm font-medium rounded-md text-gray-600 dark:text-gray-300 hover:text-gray-900 dark:hover:text-white">
                                        All Courses
                                    </a>
                                    <a href="#" class="flex items-center px-2 py-2 text-sm font-medium rounded-md text-gray-600 dark:text-gray-300 hover:text-gray-900 dark:hover:text-white">
                                        Add New
                                    </a>
                                    <a href="#" class="flex items-center px-2 py-2 text-sm font-medium rounded-md text-gray-600 dark:text-gray-300 hover:text-gray-900 dark:hover:text-white">
                                        Categories
                                    </a>
                                </div>
                            </div>
                            
                            <a href="#" class="nav-item flex items-center px-2 py-3 text-sm font-medium rounded-md text-gray-900 dark:text-white">
                                <i data-feather="clipboard" class="mr-3 h-5 w-5"></i>
                                Enrollments
                            </a>
                            
                            <a href="#" class="nav-item flex items-center px-2 py-3 text-sm font-medium rounded-md text-gray-900 dark:text-white">
                                <i data-feather="file-text" class="mr-3 h-5 w-5"></i>
                                Assignments
                            </a>
                            
                            <a href="#" class="nav-item flex items-center px-2 py-3 text-sm font-medium rounded-md text-gray-900 dark:text-white">
                                <i data-feather="award" class="mr-3 h-5 w-5"></i>
                                Certificates
                            </a>
                            
                            <a href="#" class="nav-item flex items-center px-2 py-3 text-sm font-medium rounded-md text-gray-900 dark:text-white">
                                <i data-feather="credit-card" class="mr-3 h-5 w-5"></i>
                                Payments
                            </a>
                            
                            <a href="#" class="nav-item flex items-center px-2 py-3 text-sm font-medium rounded-md text-gray-900 dark:text-white">
                                <i data-feather="settings" class="mr-3 h-5 w-5"></i>
                                Settings
                            </a>
                        </div>
                    </div>
                </div>
            </div>
        `;
        
        // Add event listeners for submenus
        const submenuButtons = this.shadowRoot.querySelectorAll('button.nav-item');
        submenuButtons.forEach(button => {
            if (button.nextElementSibling && button.nextElementSibling.classList.contains('submenu')) {
                button.addEventListener('click', () => {
                    const icon = button.querySelector('i:last-child');
                    const submenu = button.nextElementSibling;
                    
                    submenu.classList.toggle('open');
                    icon.classList.toggle('rotate-90');
                });
            }
        });
        
        // Initialize feather icons
        feather.replace();
    }
}

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