2020-09-01 12:15:43 +00:00
|
|
|
export const size = {
|
|
|
|
mobile: 375,
|
2020-09-17 10:22:47 +00:00
|
|
|
smallTablet: 600,
|
2020-09-01 12:15:43 +00:00
|
|
|
tablet: 1024,
|
2020-10-16 13:16:01 +00:00
|
|
|
desktop: 1025,
|
2019-09-04 10:29:32 +00:00
|
|
|
};
|
|
|
|
|
2020-09-01 12:15:43 +00:00
|
|
|
export const mobile = `(max-width: ${size.mobile}px)`;
|
2019-09-04 10:29:32 +00:00
|
|
|
|
2020-09-17 10:22:47 +00:00
|
|
|
export const smallTablet = `(max-width: ${size.smallTablet}px)`;
|
|
|
|
|
2020-09-01 12:15:43 +00:00
|
|
|
export const tablet = `(max-width: ${size.tablet}px)`;
|
2019-09-04 10:29:32 +00:00
|
|
|
|
2020-09-16 15:08:32 +00:00
|
|
|
export const desktop = `(min-width: ${size.desktop}px)`;
|
|
|
|
|
|
|
|
export const isMobile = () => {
|
|
|
|
return window.innerWidth < size.mobile;
|
|
|
|
};
|
|
|
|
|
2020-09-17 10:22:47 +00:00
|
|
|
export const isSmallTablet = () => {
|
|
|
|
return window.innerWidth < size.smallTablet;
|
|
|
|
};
|
|
|
|
|
2020-09-16 15:08:32 +00:00
|
|
|
export const isTablet = () => {
|
|
|
|
return window.innerWidth <= size.tablet && window.innerWidth >= size.mobile;
|
|
|
|
};
|
|
|
|
|
|
|
|
export const isDesktop = () => {
|
|
|
|
return window.innerWidth >= size.desktop;
|
|
|
|
};
|
2020-11-24 12:11:41 +00:00
|
|
|
|
|
|
|
export const isTouchDevice = !!(
|
|
|
|
typeof window !== "undefined" &&
|
|
|
|
typeof navigator !== "undefined" &&
|
|
|
|
("ontouchstart" in window || navigator.msMaxTouchPoints > 0)
|
|
|
|
);
|