feat: 新增玩法规则页并增强注单筛选与结果展示
This commit is contained in:
17
src/hooks/use-mobile.ts
Normal file
17
src/hooks/use-mobile.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
export function useIsMobile(breakpoint = 768): boolean {
|
||||
const [isMobile, setIsMobile] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
const query = window.matchMedia(`(max-width: ${breakpoint - 1}px)`);
|
||||
const update = () => setIsMobile(query.matches);
|
||||
update();
|
||||
query.addEventListener("change", update);
|
||||
return () => query.removeEventListener("change", update);
|
||||
}, [breakpoint]);
|
||||
|
||||
return isMobile;
|
||||
}
|
||||
Reference in New Issue
Block a user