Spaces:
Sleeping
Sleeping
Download frontend/src/hooks/useSidebar.ts from orakzai-io/Rednote: direct link, hf CLI and curl.
- Browser
- Download file 447 Bytes
-
https://huggingface.co/spaces/orakzai-io/Rednote/resolve/main/frontend/src/hooks/useSidebar.ts
- Command line
-
hf download hf://spaces/orakzai-io/Rednote/frontend/src/hooks/useSidebar.ts
-
curl -L -o useSidebar.ts https://huggingface.co/spaces/orakzai-io/Rednote/resolve/main/frontend/src/hooks/useSidebar.ts
447 Bytes
| 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, | |
| }; | |
| } | |