Files
ncd-fe/packages/pl-fe/src/is-mobile.ts
nicole mikołajczyk 7039f36406 pl-fe: improve stuff sorry for not descriptive commit messages
Signed-off-by: nicole mikołajczyk <git@mkljczk.pl>
2025-08-24 21:11:27 +02:00

16 lines
582 B
TypeScript

/** Breakpoint at which the application is considered "mobile". */
const LAYOUT_BREAKPOINT = 581;
/** Check if the width is small enough to be considered "mobile". */
const isMobile = (width: number) => width <= LAYOUT_BREAKPOINT;
/** Whether the device is iOS (best guess). */
const iOS: boolean = /iPad|iPhone|iPod/.test(navigator.userAgent) && !(window as any).MSStream;
const userTouching = window.matchMedia('(pointer: coarse)');
/** Whether the device is iOS (best guess). */
const isIOS = (): boolean => iOS;
export { LAYOUT_BREAKPOINT, isMobile, userTouching, isIOS };