mirror of
https://github.com/TheRealOwenRees/echecsfrance.git
synced 2026-07-23 04:26:57 +00:00
import grouping and sorting with Prettier plugin
This commit is contained in:
@@ -1,31 +1,36 @@
|
||||
export const useDynamicViewportUnits = () => {
|
||||
const setVh = function () {
|
||||
var svh = document.documentElement.clientHeight * 0.01;
|
||||
document.documentElement.style.setProperty('--1svh', (svh + "px"));
|
||||
document.documentElement.style.setProperty("--1svh", svh + "px");
|
||||
var dvh = window.innerHeight * 0.01;
|
||||
document.documentElement.style.setProperty('--1dvh', (dvh + "px"));
|
||||
document.documentElement.style.setProperty("--1dvh", dvh + "px");
|
||||
};
|
||||
|
||||
const isMobile = function() {
|
||||
if(/Android|iPhone|iPad|iPod/i.test(navigator.userAgent) || (navigator.userAgent.match(/Mac/) && navigator.maxTouchPoints && navigator.maxTouchPoints > 2)) {
|
||||
return true;
|
||||
const isMobile = function () {
|
||||
if (
|
||||
/Android|iPhone|iPad|iPod/i.test(navigator.userAgent) ||
|
||||
(navigator.userAgent.match(/Mac/) &&
|
||||
navigator.maxTouchPoints &&
|
||||
navigator.maxTouchPoints > 2)
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// SSR support
|
||||
if (typeof window === 'undefined') {
|
||||
if (typeof window === "undefined") {
|
||||
return;
|
||||
}
|
||||
|
||||
// Don't run polyfill if browser supports the units natively
|
||||
if ('CSS' in window &&
|
||||
'supports' in window.CSS &&
|
||||
window.CSS.supports('height: 100svh') &&
|
||||
window.CSS.supports('height: 100dvh') &&
|
||||
window.CSS.supports('height: 100lvh')
|
||||
if (
|
||||
"CSS" in window &&
|
||||
"supports" in window.CSS &&
|
||||
window.CSS.supports("height: 100svh") &&
|
||||
window.CSS.supports("height: 100dvh") &&
|
||||
window.CSS.supports("height: 100lvh")
|
||||
) {
|
||||
return;
|
||||
}
|
||||
@@ -35,10 +40,10 @@ export const useDynamicViewportUnits = () => {
|
||||
return;
|
||||
}
|
||||
|
||||
window.addEventListener('resize', setVh);
|
||||
window.addEventListener("resize", setVh);
|
||||
setVh();
|
||||
|
||||
return () => {
|
||||
window.removeEventListener('resize', setVh);
|
||||
}
|
||||
}
|
||||
window.removeEventListener("resize", setVh);
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user