Make the room list sidebar resizable

Generalizes useResizableWidth with a left/right anchor option and wires
it into the sidebar the same way the room info panel already uses it,
so both sides of the chat shell can be dragged to a comfortable width.
This commit is contained in:
2026-08-14 20:45:07 -06:00
parent 91589ee647
commit 8e3b6a16bd
3 changed files with 47 additions and 8 deletions
+11 -1
View File
@@ -1,3 +1,4 @@
import { useResizableWidth } from '../hooks/useResizableWidth'
import type { MyRoomItem } from '../types'
import { RoomRow } from './RoomRow'
import './Sidebar.css'
@@ -24,8 +25,17 @@ export function Sidebar({
const query = searchQuery.trim().toLowerCase()
const filtered = query ? rooms.filter((r) => r.name.toLowerCase().includes(query)) : rooms
const { width, startResize } = useResizableWidth({
storageKey: 'sidebar-width',
defaultWidth: 300,
min: 220,
max: 480,
anchor: 'left',
})
return (
<aside className="sidebar">
<aside className="sidebar" style={{ width }}>
<div className="sidebar-resize-handle" onPointerDown={startResize} />
<div className="sidebar-toolbar">
<div className="sidebar-search">
<svg width="14" height="14" viewBox="0 0 20 20" fill="none" aria-hidden="true">