2023-12-06 18:11:14 +00:00
|
|
|
export const INFO_PANEL_WIDTH = 400;
|
2023-11-24 07:43:45 +00:00
|
|
|
|
|
|
|
export function checkIsSSR() {
|
|
|
|
return typeof window === "undefined";
|
|
|
|
}
|
2023-11-23 15:25:24 +00:00
|
|
|
|
|
|
|
export const size = {
|
|
|
|
mobile: 600,
|
|
|
|
// table: is between
|
|
|
|
desktop: 1024,
|
|
|
|
};
|
|
|
|
|
|
|
|
export const mobile = `(max-width: ${size.mobile}px)`;
|
|
|
|
|
|
|
|
export const mobileMore = `(min-width: ${size.mobile}px)`;
|
|
|
|
|
|
|
|
export const tablet = `(max-width: ${size.desktop - 0.1}px)`;
|
|
|
|
|
|
|
|
export const desktop = `(min-width: ${size.desktop}px)`;
|
|
|
|
|
|
|
|
export const transitionalScreenSize = `(max-width: ${
|
|
|
|
size.desktop + INFO_PANEL_WIDTH
|
|
|
|
}px)`;
|
|
|
|
|
|
|
|
export const isMobile = () => {
|
|
|
|
return window.innerWidth <= size.mobile;
|
|
|
|
};
|
|
|
|
|
2024-01-25 08:17:19 +00:00
|
|
|
export const isTablet = (width?: number) => {
|
2023-11-23 15:25:24 +00:00
|
|
|
const checkWidth = width || window.innerWidth;
|
|
|
|
return checkWidth > size.mobile && checkWidth < size.desktop;
|
|
|
|
};
|
|
|
|
|
|
|
|
export const isDesktop = () => {
|
|
|
|
if (!checkIsSSR()) {
|
|
|
|
return window.innerWidth >= size.desktop;
|
2023-11-24 07:43:45 +00:00
|
|
|
}
|
|
|
|
return false;
|
2023-11-23 15:25:24 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
export const isTouchDevice = !!(
|
|
|
|
typeof window !== "undefined" &&
|
|
|
|
typeof navigator !== "undefined" &&
|
|
|
|
("ontouchstart" in window || navigator.maxTouchPoints > 0)
|
|
|
|
);
|