feat(component): helper function observeResize to observe size change via global ResizeObserver (#7241)

```ts
import { observeResize } from "@affine/component";

useEffect(() => {
  const dispose = observeResize(element entry => {
    console.log(entry.contentRect);
  });

  return () => dispose();
}, []);
```
This commit is contained in:
CatsJuice
2024-06-19 09:04:56 +00:00
parent be36e033f2
commit 98e35384a6
5 changed files with 83 additions and 15 deletions

View File

@@ -24,3 +24,4 @@ export * from './ui/switch';
export * from './ui/table';
export * from './ui/toast';
export * from './ui/tooltip';
export * from './utils';