Spaces:
Runtime error
Runtime error
fix sidebar style
Browse filesSigned-off-by: Jintao Zhang <zhangjintao9020@gmail.com>
- src/App.jsx +12 -0
- src/index.css +33 -3
src/App.jsx
CHANGED
|
@@ -132,6 +132,8 @@ function App() {
|
|
| 132 |
<button
|
| 133 |
className="bg-transparent border-0 text-base text-lightest-text cursor-pointer flex items-center justify-center z-10 w-6 h-6 hover:text-text"
|
| 134 |
onClick={toggleSidebar}
|
|
|
|
|
|
|
| 135 |
>
|
| 136 |
{sidebarCollapsed ? '→' : '←'}
|
| 137 |
</button>
|
|
@@ -146,6 +148,16 @@ function App() {
|
|
| 146 |
/>
|
| 147 |
</div>
|
| 148 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 149 |
<div className="flex-1 flex flex-col overflow-hidden bg-background">
|
| 150 |
{currentChatId ? (
|
| 151 |
<ChatWindow
|
|
|
|
| 132 |
<button
|
| 133 |
className="bg-transparent border-0 text-base text-lightest-text cursor-pointer flex items-center justify-center z-10 w-6 h-6 hover:text-text"
|
| 134 |
onClick={toggleSidebar}
|
| 135 |
+
aria-label={sidebarCollapsed ? 'Expand sidebar' : 'Collapse sidebar'}
|
| 136 |
+
title={sidebarCollapsed ? 'Expand sidebar' : 'Collapse sidebar'}
|
| 137 |
>
|
| 138 |
{sidebarCollapsed ? '→' : '←'}
|
| 139 |
</button>
|
|
|
|
| 148 |
/>
|
| 149 |
</div>
|
| 150 |
|
| 151 |
+
{/* Floating expand button that appears when sidebar is collapsed */}
|
| 152 |
+
<button
|
| 153 |
+
className="expand-sidebar-button"
|
| 154 |
+
onClick={toggleSidebar}
|
| 155 |
+
aria-label="Expand sidebar"
|
| 156 |
+
title="Expand sidebar"
|
| 157 |
+
>
|
| 158 |
+
→
|
| 159 |
+
</button>
|
| 160 |
+
|
| 161 |
<div className="flex-1 flex flex-col overflow-hidden bg-background">
|
| 162 |
{currentChatId ? (
|
| 163 |
<ChatWindow
|
src/index.css
CHANGED
|
@@ -115,17 +115,24 @@ body {
|
|
| 115 |
@apply w-[50px] overflow-hidden;
|
| 116 |
}
|
| 117 |
|
| 118 |
-
.sidebar.collapsed .chat-list
|
|
|
|
|
|
|
|
|
|
| 119 |
.sidebar.collapsed .sidebar-header h2 {
|
| 120 |
@apply hidden;
|
| 121 |
}
|
| 122 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 123 |
.sidebar-header {
|
| 124 |
@apply flex justify-between items-center py-3 px-4 border-b border-border;
|
| 125 |
}
|
| 126 |
|
| 127 |
.sidebar.collapsed .sidebar-header {
|
| 128 |
-
@apply py-3 px-[5px]
|
| 129 |
}
|
| 130 |
|
| 131 |
.sidebar-header h2 {
|
|
@@ -139,6 +146,24 @@ body {
|
|
| 139 |
.toggle-sidebar-button:hover {
|
| 140 |
@apply text-text;
|
| 141 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 142 |
}
|
| 143 |
|
| 144 |
@layer components {
|
|
@@ -577,12 +602,17 @@ body {
|
|
| 577 |
left: 0;
|
| 578 |
}
|
| 579 |
|
| 580 |
-
/*
|
| 581 |
.sidebar.collapsed {
|
| 582 |
width: 50px;
|
| 583 |
left: 0;
|
| 584 |
}
|
| 585 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 586 |
.message-content {
|
| 587 |
max-width: 100%;
|
| 588 |
}
|
|
|
|
| 115 |
@apply w-[50px] overflow-hidden;
|
| 116 |
}
|
| 117 |
|
| 118 |
+
.sidebar.collapsed .chat-list {
|
| 119 |
+
@apply hidden;
|
| 120 |
+
}
|
| 121 |
+
|
| 122 |
.sidebar.collapsed .sidebar-header h2 {
|
| 123 |
@apply hidden;
|
| 124 |
}
|
| 125 |
|
| 126 |
+
.sidebar.collapsed .sidebar-header {
|
| 127 |
+
@apply justify-center;
|
| 128 |
+
}
|
| 129 |
+
|
| 130 |
.sidebar-header {
|
| 131 |
@apply flex justify-between items-center py-3 px-4 border-b border-border;
|
| 132 |
}
|
| 133 |
|
| 134 |
.sidebar.collapsed .sidebar-header {
|
| 135 |
+
@apply py-3 px-[5px];
|
| 136 |
}
|
| 137 |
|
| 138 |
.sidebar-header h2 {
|
|
|
|
| 146 |
.toggle-sidebar-button:hover {
|
| 147 |
@apply text-text;
|
| 148 |
}
|
| 149 |
+
|
| 150 |
+
/* Ensure the toggle button is always visible and clickable */
|
| 151 |
+
.sidebar.collapsed .toggle-sidebar-button {
|
| 152 |
+
@apply opacity-100 visible;
|
| 153 |
+
}
|
| 154 |
+
|
| 155 |
+
/* Floating expand button that appears when sidebar is collapsed */
|
| 156 |
+
.expand-sidebar-button {
|
| 157 |
+
@apply fixed left-[60px] top-[80px] bg-background border border-border rounded-full w-8 h-8 flex items-center justify-center cursor-pointer shadow-md z-20 opacity-0 invisible transition-all duration-300;
|
| 158 |
+
}
|
| 159 |
+
|
| 160 |
+
.sidebar.collapsed ~ .expand-sidebar-button {
|
| 161 |
+
@apply opacity-100 visible;
|
| 162 |
+
}
|
| 163 |
+
|
| 164 |
+
.expand-sidebar-button:hover {
|
| 165 |
+
@apply bg-hover text-text;
|
| 166 |
+
}
|
| 167 |
}
|
| 168 |
|
| 169 |
@layer components {
|
|
|
|
| 602 |
left: 0;
|
| 603 |
}
|
| 604 |
|
| 605 |
+
/* Make sure the collapsed sidebar is still visible on mobile */
|
| 606 |
.sidebar.collapsed {
|
| 607 |
width: 50px;
|
| 608 |
left: 0;
|
| 609 |
}
|
| 610 |
|
| 611 |
+
/* Hide the floating expand button on mobile as it's not needed */
|
| 612 |
+
.expand-sidebar-button {
|
| 613 |
+
display: none;
|
| 614 |
+
}
|
| 615 |
+
|
| 616 |
.message-content {
|
| 617 |
max-width: 100%;
|
| 618 |
}
|