mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-21 00:01:22 +02:00
Fix resize observer
This commit is contained in:
@@ -22,7 +22,7 @@ const drag = { gridArea: 'drag' };
|
|||||||
const DEFAULT = 0.5;
|
const DEFAULT = 0.5;
|
||||||
const MIN_WIDTH_PX = 10;
|
const MIN_WIDTH_PX = 10;
|
||||||
const MIN_HEIGHT_PX = 30;
|
const MIN_HEIGHT_PX = 30;
|
||||||
const STACK_VERTICAL_WIDTH = 600;
|
const STACK_VERTICAL_WIDTH = 700;
|
||||||
|
|
||||||
export const RequestResponse = memo(function RequestResponse({ style }: Props) {
|
export const RequestResponse = memo(function RequestResponse({ style }: Props) {
|
||||||
const containerRef = useRef<HTMLDivElement>(null);
|
const containerRef = useRef<HTMLDivElement>(null);
|
||||||
@@ -37,9 +37,8 @@ export const RequestResponse = memo(function RequestResponse({ style }: Props) {
|
|||||||
null,
|
null,
|
||||||
);
|
);
|
||||||
|
|
||||||
useResizeObserver(containerRef, ({ contentRect }) => {
|
useResizeObserver(containerRef.current, ({ contentRect }) => {
|
||||||
const doIt = contentRect.width < STACK_VERTICAL_WIDTH;
|
setVertical(contentRect.width < STACK_VERTICAL_WIDTH);
|
||||||
setVertical(doIt);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const styles = useMemo<CSSProperties>(
|
const styles = useMemo<CSSProperties>(
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ export function SettingsDropdown() {
|
|||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<IconButton size="sm" title="Main Menu" icon="hamburger" className="pointer-events-auto" />
|
<IconButton size="sm" title="Main Menu" icon="gear" className="pointer-events-auto" />
|
||||||
</Dropdown>
|
</Dropdown>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "ESNext",
|
"target": "es2021",
|
||||||
"useDefineForClassFields": true,
|
"useDefineForClassFields": true,
|
||||||
"lib": ["DOM", "DOM.Iterable", "ESNext"],
|
"lib": ["DOM", "DOM.Iterable", "ESNext"],
|
||||||
"allowJs": false,
|
"allowJs": false,
|
||||||
|
|||||||
Reference in New Issue
Block a user