mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-05 20:34:18 +01:00
docs: document mobile session hooks, plugin test helpers, and viewport detection
This commit is contained in:
1 parent
b974618dee
commit
f80aa1c0e5
5 files changed
+14
No files matched your search
@@ -1,14 +1,17 @@
|
||||
import { useState, useEffect, useCallback, useRef, type CSSProperties } from 'react'
|
||||
import { useSwipeNavigation } from '@/contexts/SwipeNavigationContext'
|
||||
|
||||
/** Returns whether the viewport is narrower than 768 pixels, or false without a browser window. */
|
||||
export function isMobileViewport(): boolean {
|
||||
return typeof window !== 'undefined' ? window.innerWidth < 768 : false
|
||||
}
|
||||
|
||||
/** Tracks whether the current viewport is mobile, updating the value on window resize. */
|
||||
export function useMobile() {
|
||||
const [isMobile, setIsMobile] = useState(isMobileViewport)
|
||||
|
||||
useEffect(() => {
|
||||
/** Refreshes the mobile state from the current viewport width. */
|
||||
const checkMobile = () => {
|
||||
setIsMobile(isMobileViewport())
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user