chore: add use reponsive width

This commit is contained in:
Steven
2023-11-10 11:22:32 +08:00
parent 9227ca5b5b
commit 0ea0645258
5 changed files with 33 additions and 11 deletions

View File

@ -0,0 +1,18 @@
import useWindowSize from "react-use/lib/useWindowSize";
enum TailwindResponsiveWidth {
sm = 640,
md = 768,
lg = 1024,
}
const useResponsiveWidth = () => {
const { width } = useWindowSize();
return {
sm: width >= TailwindResponsiveWidth.sm,
md: width >= TailwindResponsiveWidth.md,
lg: width >= TailwindResponsiveWidth.lg,
};
};
export default useResponsiveWidth;