File size: 2,214 Bytes
9f828c9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
class CustomTopbar extends HTMLElement {
    constructor() {
        super();
        this.attachShadow({ mode: 'open' });
        this.shadowRoot.innerHTML = `
            <style>
                .topbar {
                    background: white;
                    border-bottom: 1px solid #e5e7eb;
                    padding: 1rem 1.5rem;
                }
                .tab {
                    padding-bottom: 0.5rem;
                    transition: all 0.2s;
                }
                .tab.active {
                    border-bottom: 2px solid #3b82f6;
                    color: #3b82f6;
                }
                .tab:not(.active) {
                    color: #4b5563;
                }
                .tab:not(.active):hover {
                    color: #1f2937;
                }
            </style>
            <div class="topbar flex items-center justify-between">
                <div class="flex gap-6">
                    <button class="tab active">
                        <span>💬 Chat</span>
                    </button>
                    <button class="tab">
                        <span>📝 Code</span>
                    </button>
                    <button class="tab">
                        <span>📊 JSON</span>
                    </button>
                </div>
                <div class="flex gap-3">
                    <button class="px-4 py-2 bg-green-500 text-white rounded-lg text-sm font-medium hover:bg-green-600">
                        ● Prêt
                    </button>
                    <button class="px-4 py-2 bg-blue-600 text-white rounded-lg text-sm font-medium hover:bg-blue-700">
                        ⬆ Recharger
                    </button>
                </div>
            </div>
        `;
    }

    connectedCallback() {
        // Tab switching functionality
        this.shadowRoot.querySelectorAll('.tab').forEach(tab => {
            tab.addEventListener('click', () => {
                this.shadowRoot.querySelectorAll('.tab').forEach(t => t.classList.remove('active'));
                tab.classList.add('active');
            });
        });
    }
}

customElements.define('custom-topbar', CustomTopbar);