nixaut-codelabs commited on
Commit
24ed5fc
·
verified ·
1 Parent(s): f775c38

Fix the sidebar so it integrates seamlessly with the site.

Browse files
Files changed (2) hide show
  1. components/sidebar.js +12 -12
  2. style.css +26 -1
components/sidebar.js CHANGED
@@ -294,16 +294,16 @@ class CustomSidebar extends HTMLElement {
294
  }
295
  }
296
  </style>
297
- <nav class="sidebar">
298
- <div class="sidebar-buttons">
299
- <button onclick="startNewChat()" class="new-chat-btn">
300
- <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
301
  <path d="M12 5v14m-7-7h14"/>
302
  </svg>
303
  <span>New Chat</span>
304
  </button>
305
- <button onclick="window.location.href='/media'" class="sidebar-btn">
306
- <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
307
  <rect x="3" y="3" width="18" height="18" rx="2" ry="2"/>
308
  <circle cx="8.5" cy="8.5" r="1.5"/>
309
  <path d="M21 15l-5-5L5 21"/>
@@ -311,18 +311,18 @@ class CustomSidebar extends HTMLElement {
311
  <span>Media Library</span>
312
  </button>
313
  </div>
314
- <div class="history-section">
315
- <div class="history-header">
316
  <span class="history-title">Chat History</span>
317
  <div class="history-actions">
318
- <button class="history-action-btn" title="Search">
319
- <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
320
  <circle cx="11" cy="11" r="8"/>
321
  <path d="m21 21-4.35-4.35"/>
322
  </svg>
323
  </button>
324
- <button class="history-action-btn" title="Clear">
325
- <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
326
  <path d="M3 6h18M8 6V4a2 2 0 012-2h4a2 2 0 012 2v2m3 0v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6h14zM10 11v6M14 11v6"/>
327
  </svg>
328
  </button>
 
294
  }
295
  }
296
  </style>
297
+ <nav class="sidebar" role="navigation" aria-label="Main navigation">
298
+ <div class="sidebar-buttons">
299
+ <button onclick="startNewChat()" class="new-chat-btn" aria-label="Start a new chat">
300
+ <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
301
  <path d="M12 5v14m-7-7h14"/>
302
  </svg>
303
  <span>New Chat</span>
304
  </button>
305
+ <button onclick="window.location.href='/media'" class="sidebar-btn" aria-label="Go to media library">
306
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
307
  <rect x="3" y="3" width="18" height="18" rx="2" ry="2"/>
308
  <circle cx="8.5" cy="8.5" r="1.5"/>
309
  <path d="M21 15l-5-5L5 21"/>
 
311
  <span>Media Library</span>
312
  </button>
313
  </div>
314
+ <div class="history-section" role="region" aria-label="Chat history">
315
+ <div class="history-header">
316
  <span class="history-title">Chat History</span>
317
  <div class="history-actions">
318
+ <button class="history-action-btn" title="Search chat history" aria-label="Search">
319
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
320
  <circle cx="11" cy="11" r="8"/>
321
  <path d="m21 21-4.35-4.35"/>
322
  </svg>
323
  </button>
324
+ <button class="history-action-btn" title="Clear chat history" aria-label="Clear">
325
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
326
  <path d="M3 6h18M8 6V4a2 2 0 012-2h4a2 2 0 012 2v2m3 0v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6h14zM10 11v6M14 11v6"/>
327
  </svg>
328
  </button>
style.css CHANGED
@@ -144,6 +144,7 @@ body {
144
  /* Sidebar adjustments for main content */
145
  main {
146
  margin-left: 0;
 
147
  }
148
 
149
  /* Mobile Responsive */
@@ -159,14 +160,38 @@ main {
159
  .sidebar.active {
160
  transform: translateX(0);
161
  }
 
 
 
 
162
  }
 
163
  /* Desktop Responsive */
164
  @media (min-width: 769px) {
165
  main {
166
  margin-left: 260px !important;
167
  position: relative;
168
- z-index: 5;
 
 
 
 
169
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
170
  }
171
  /* Loading Skeleton */
172
  .skeleton {
 
144
  /* Sidebar adjustments for main content */
145
  main {
146
  margin-left: 0;
147
+ transition: margin-left 0.3s ease;
148
  }
149
 
150
  /* Mobile Responsive */
 
160
  .sidebar.active {
161
  transform: translateX(0);
162
  }
163
+
164
+ body.sidebar-open main {
165
+ margin-left: 0 !important;
166
+ }
167
  }
168
+
169
  /* Desktop Responsive */
170
  @media (min-width: 769px) {
171
  main {
172
  margin-left: 260px !important;
173
  position: relative;
174
+ z-index: 10;
175
+ }
176
+
177
+ body:not(.sidebar-closed) main {
178
+ margin-left: 260px !important;
179
  }
180
+
181
+ body.sidebar-closed main {
182
+ margin-left: 0 !important;
183
+ }
184
+ }
185
+
186
+ /* Sidebar Transitions */
187
+ .sidebar {
188
+ transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
189
+ }
190
+
191
+ .sidebar * {
192
+ transition-property: background, border-color, transform, box-shadow;
193
+ transition-duration: 0.2s;
194
+ transition-timing-function: ease;
195
  }
196
  /* Loading Skeleton */
197
  .skeleton {