diff --git a/src/utils/helpers.ts b/src/utils/helpers.ts index 1fa978d..cb0b41e 100644 --- a/src/utils/helpers.ts +++ b/src/utils/helpers.ts @@ -2,8 +2,16 @@ export function classNames(...classes: (string | null | undefined)[]) { return classes.filter(Boolean).join(" "); } -const hoverableQuery = window.matchMedia('(hover: hover) and (pointer: fine)'); +const isClient = (): boolean => { + return typeof window !== "undefined"; +} + +const isServer = (): boolean => { + return !isClient(); +} + +const hoverableQuery: MediaQueryList | null = isClient() ? window.matchMedia('(hover: hover) and (pointer: fine)') : null; export function isHoverable() { - return hoverableQuery.matches; + return hoverableQuery?.matches; } \ No newline at end of file