mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-10-30 10:42:09 +08:00
feat: auto proxy layout column
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
export const useWindowWidth = () => {
|
||||
const [width, setWidth] = useState(() => document.body.clientWidth);
|
||||
|
||||
useEffect(() => {
|
||||
const handleResize = () => setWidth(document.body.clientWidth);
|
||||
|
||||
window.addEventListener("resize", handleResize);
|
||||
return () => {
|
||||
window.removeEventListener("resize", handleResize);
|
||||
};
|
||||
}, []);
|
||||
|
||||
return { width };
|
||||
};
|
||||
Reference in New Issue
Block a user