Move app to apps/web-react in pnpm workspace layout

This commit is contained in:
Kalle
2026-08-16 09:20:33 +03:00
parent 7e365ccfcf
commit bbc8ea57af
2913 changed files with 227 additions and 250 deletions

View File

@@ -0,0 +1,31 @@
import * as React from "react";
interface WindowSize {
width: number;
height: number;
}
function subscribe(listener: () => void) {
window.addEventListener("resize", listener);
return () => window.removeEventListener("resize", listener);
}
/**
* Returns the current window dimensions, re-rendering on resize. Both
* dimensions are `0` during server-side rendering and the initial hydration
* render.
*/
export function useWindowSize(): WindowSize {
const width = React.useSyncExternalStore(
subscribe,
() => window.innerWidth,
() => 0,
);
const height = React.useSyncExternalStore(
subscribe,
() => window.innerHeight,
() => 0,
);
return { width, height };
}