nixaut-codelabs commited on
Commit
c6e5d8e
·
verified ·
1 Parent(s): 0bb1e58

sidebarı sola sabitle site ile iç içe giriyor

Browse files
Files changed (3) hide show
  1. components/sidebar.js +59 -10
  2. index.html +1 -1
  3. style.css +9 -1
components/sidebar.js CHANGED
@@ -1,8 +1,12 @@
1
 
2
  class CustomSidebar extends HTMLElement {
3
- connectedCallback() {
 
4
  this.attachShadow({ mode: 'open' });
5
- this.shadowRoot.innerHTML = `
 
 
 
6
  <style>
7
  @import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');
8
  * { font-family: 'Inter', sans-serif; }
@@ -15,9 +19,7 @@ class CustomSidebar extends HTMLElement {
15
  padding: 1.5rem 0 5rem;
16
  overflow-y: auto;
17
  height: 100vh;
18
- position: fixed;
19
- left: 0;
20
- top: 0;
21
  z-index: 40;
22
  transition: transform 0.3s ease;
23
  }
@@ -207,6 +209,7 @@ class CustomSidebar extends HTMLElement {
207
  }
208
  @media (max-width: 768px) {
209
  .sidebar {
 
210
  transform: translateX(-100%);
211
  }
212
 
@@ -214,11 +217,13 @@ class CustomSidebar extends HTMLElement {
214
  transform: translateX(0);
215
  }
216
 
217
- .fixed.bottom-0.left-0.w-\[280px\] {
 
218
  transform: translateX(-100%);
219
  }
220
 
221
- .sidebar.active ~ .fixed.bottom-0.left-0.w-\[280px\] {
 
222
  transform: translateX(0);
223
  }
224
  }
@@ -346,10 +351,11 @@ class CustomSidebar extends HTMLElement {
346
  </div>
347
  </div>
348
  </div>
349
- </nav>
 
350
  <!-- Fixed Bottom Account -->
351
  <div class="fixed bottom-0 left-0 w-[280px] bg-zinc-900/95 backdrop-blur-xl border-t border-zinc-800 p-3 z-50">
352
- <button onclick="openAccount()" class="account-btn">
353
  <div class="account-icon">
354
  U
355
  </div>
@@ -362,7 +368,50 @@ class CustomSidebar extends HTMLElement {
362
  </svg>
363
  </button>
364
  </div>
365
- `;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
366
  }
367
  }
368
 
 
1
 
2
  class CustomSidebar extends HTMLElement {
3
+ constructor() {
4
+ super();
5
  this.attachShadow({ mode: 'open' });
6
+ }
7
+
8
+ connectedCallback() {
9
+ this.shadowRoot.innerHTML = `
10
  <style>
11
  @import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');
12
  * { font-family: 'Inter', sans-serif; }
 
19
  padding: 1.5rem 0 5rem;
20
  overflow-y: auto;
21
  height: 100vh;
22
+ position: relative;
 
 
23
  z-index: 40;
24
  transition: transform 0.3s ease;
25
  }
 
209
  }
210
  @media (max-width: 768px) {
211
  .sidebar {
212
+ position: fixed;
213
  transform: translateX(-100%);
214
  }
215
 
 
217
  transform: translateX(0);
218
  }
219
 
220
+ .fixed.bottom-0 {
221
+ position: fixed;
222
  transform: translateX(-100%);
223
  }
224
 
225
+ .sidebar.active ~ .fixed.bottom-0,
226
+ .fixed.bottom-0.active {
227
  transform: translateX(0);
228
  }
229
  }
 
351
  </div>
352
  </div>
353
  </div>
354
+ </nav>
355
+ </div>
356
  <!-- Fixed Bottom Account -->
357
  <div class="fixed bottom-0 left-0 w-[280px] bg-zinc-900/95 backdrop-blur-xl border-t border-zinc-800 p-3 z-50">
358
+ <button onclick="openAccount()" class="account-btn">
359
  <div class="account-icon">
360
  U
361
  </div>
 
368
  </svg>
369
  </button>
370
  </div>
371
+ `;
372
+
373
+ // Add mobile menu toggle
374
+ this.setupMobileMenu();
375
+ }
376
+
377
+ setupMobileMenu() {
378
+ // Create mobile menu button
379
+ const menuButton = document.createElement('button');
380
+ menuButton.className = 'mobile-menu-trigger';
381
+ menuButton.innerHTML = `
382
+ <style>
383
+ .mobile-menu-trigger {
384
+ display: none;
385
+ position: fixed;
386
+ top: 1rem;
387
+ left: 1rem;
388
+ z-index: 50;
389
+ background: rgba(9, 9, 11, 0.9);
390
+ border: 1px solid rgba(255, 255, 255, 0.1);
391
+ border-radius: 8px;
392
+ padding: 0.5rem;
393
+ cursor: pointer;
394
+ }
395
+
396
+ @media (max-width: 768px) {
397
+ .mobile-menu-trigger {
398
+ display: block;
399
+ }
400
+ }
401
+ </style>
402
+ <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2">
403
+ <path d="M3 12h18M3 6h18M3 18h18"/>
404
+ </svg>
405
+ `;
406
+
407
+ menuButton.onclick = () => {
408
+ const sidebar = this.shadowRoot.querySelector('.sidebar');
409
+ const accountPanel = sidebar.nextElementSibling;
410
+ sidebar.classList.toggle('active');
411
+ accountPanel.classList.toggle('active');
412
+ };
413
+
414
+ document.body.appendChild(menuButton);
415
  }
416
  }
417
 
index.html CHANGED
@@ -63,7 +63,7 @@
63
  <div class="flex h-screen relative z-10">
64
  <custom-sidebar></custom-sidebar>
65
  <!-- Main Chat Area -->
66
- <main class="flex-1 flex flex-col bg-zinc-950 relative overflow-hidden max-h-full">
67
  <!-- Chat Header -->
68
  <div class="bg-zinc-900/30 backdrop-blur-lg border-b border-zinc-800 p-4 flex items-center justify-between">
69
  <div class="flex items-center space-x-3">
 
63
  <div class="flex h-screen relative z-10">
64
  <custom-sidebar></custom-sidebar>
65
  <!-- Main Chat Area -->
66
+ <main class="flex-1 flex flex-col bg-zinc-950 relative overflow-hidden max-h-full ml-0">
67
  <!-- Chat Header -->
68
  <div class="bg-zinc-900/30 backdrop-blur-lg border-b border-zinc-800 p-4 flex items-center justify-between">
69
  <div class="flex items-center space-x-3">
style.css CHANGED
@@ -144,10 +144,11 @@ body {
144
  /* Mobile Responsive */
145
  @media (max-width: 768px) {
146
  main {
147
- margin-left: 0 !important;
148
  }
149
 
150
  .sidebar {
 
151
  transform: translateX(-100%);
152
  transition: transform 0.3s ease;
153
  }
@@ -156,6 +157,13 @@ body {
156
  transform: translateX(0);
157
  }
158
  }
 
 
 
 
 
 
 
159
  /* Loading Skeleton */
160
  .skeleton {
161
  background: linear-gradient(90deg, #18181b 25%, #27272a 50%, #18181b 75%);
 
144
  /* Mobile Responsive */
145
  @media (max-width: 768px) {
146
  main {
147
+ margin-left: 0;
148
  }
149
 
150
  .sidebar {
151
+ position: fixed;
152
  transform: translateX(-100%);
153
  transition: transform 0.3s ease;
154
  }
 
157
  transform: translateX(0);
158
  }
159
  }
160
+
161
+ /* Desktop Responsive */
162
+ @media (min-width: 769px) {
163
+ main {
164
+ margin-left: 280px;
165
+ }
166
+ }
167
  /* Loading Skeleton */
168
  .skeleton {
169
  background: linear-gradient(90deg, #18181b 25%, #27272a 50%, #18181b 75%);