Let composer controls adapt to narrow panes (#1270)

This commit is contained in:
Mohamed Boudra
2026-06-01 22:58:03 +08:00
committed by GitHub
parent 1ede1bccf7
commit ce8ad8c68f
7 changed files with 118 additions and 39 deletions
@@ -20,11 +20,14 @@ export function useContainerWidth(): {
/**
* Tracks only whether a container is narrower than a threshold.
*/
export function useContainerWidthBelow(threshold: number): {
export function useContainerWidthBelow(
threshold: number,
options?: { initialIsBelow?: boolean },
): {
onLayout: (e: LayoutChangeEvent) => void;
isBelow: boolean;
} {
const [isBelow, setIsBelow] = useState(true);
const [isBelow, setIsBelow] = useState(options?.initialIsBelow ?? true);
return {
onLayout: useCallback(
(e: LayoutChangeEvent) => {