login and onboarding fixes

This commit is contained in:
Alejandro Gomez
2023-02-12 13:31:48 +01:00
committed by Kieran
parent 73957e6510
commit 4f222fb813
28 changed files with 346 additions and 144 deletions

View File

@ -0,0 +1,23 @@
import { useRef, useState, useEffect } from "react";
export default function useClientWidth() {
const ref = useRef<HTMLDivElement | null>(null);
const [width, setWidth] = useState(0);
useEffect(() => {
const updateSize = () => {
if (ref.current) {
setWidth(ref.current.clientWidth);
}
};
window.addEventListener("resize", updateSize);
updateSize();
return () => window.removeEventListener("resize", updateSize);
}, [ref]);
return {
ref,
width,
};
}