Spaces:
Sleeping
Sleeping
File size: 447 Bytes
194aaa5 9f836e6 194aaa5 9f836e6 194aaa5 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | import { useState } from 'react';
function isMobile() {
return typeof window !== 'undefined' && window.innerWidth <= 768;
}
export function useSidebar() {
// Start closed on mobile so chat fills the screen; open on desktop
const [sidebarOpen, setSidebarOpen] = useState(() => !isMobile());
const toggleSidebar = () => {
setSidebarOpen((prev) => !prev);
};
return {
sidebarOpen,
toggleSidebar,
};
}
|