feat(app): collapse workspace header button labels on narrow rows
Measure the header row width and hide text labels on the Open, Scripts, and git action split buttons below 700px so the header fits without wrapping on split-pane layouts.
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
import { useCallback, useState } from "react";
|
||||
import type { LayoutChangeEvent } from "react-native";
|
||||
|
||||
/**
|
||||
* Tracks the width of a container via onLayout.
|
||||
*/
|
||||
export function useContainerWidth(): {
|
||||
onLayout: (e: LayoutChangeEvent) => void;
|
||||
width: number;
|
||||
} {
|
||||
const [width, setWidth] = useState(0);
|
||||
return {
|
||||
onLayout: useCallback((e: LayoutChangeEvent) => {
|
||||
setWidth(e.nativeEvent.layout.width);
|
||||
}, []),
|
||||
width,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user