Update AGENTS.md. Start fixing old weird errors
This commit is contained in:
@@ -2,7 +2,7 @@ import * as React from 'react';
|
||||
|
||||
const MOBILE_BREAKPOINT = 768;
|
||||
|
||||
export function useIsMobile() {
|
||||
export const useIsMobile = () => {
|
||||
const [isMobile, setIsMobile] = React.useState<boolean | undefined>(
|
||||
undefined,
|
||||
);
|
||||
@@ -18,4 +18,4 @@ export function useIsMobile() {
|
||||
}, []);
|
||||
|
||||
return !!isMobile;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -9,12 +9,12 @@ type EventType =
|
||||
| 'focusin'
|
||||
| 'focusout';
|
||||
|
||||
export function useOnClickOutside<T extends HTMLElement = HTMLElement>(
|
||||
export const useOnClickOutside = <T,>(
|
||||
ref: React.RefObject<T | null> | React.RefObject<T | null>[],
|
||||
handler: (event: MouseEvent | TouchEvent | FocusEvent) => void,
|
||||
eventType: EventType = 'mousedown',
|
||||
eventListenerOptions: AddEventListenerOptions = {},
|
||||
): void {
|
||||
): void => {
|
||||
const savedHandler = React.useRef(handler);
|
||||
|
||||
React.useLayoutEffect(() => {
|
||||
@@ -55,6 +55,6 @@ export function useOnClickOutside<T extends HTMLElement = HTMLElement>(
|
||||
);
|
||||
};
|
||||
}, [ref, eventType, eventListenerOptions]);
|
||||
}
|
||||
};
|
||||
|
||||
export type { EventType };
|
||||
|
||||
Reference in New Issue
Block a user