Files
xevion.dev/src/utils/helpers.ts
Xevion 253930aac2 Fixed mobile not toggling on/off properly
- Chrome & Firefox Mobile issue
- Despite not having hover in JS, CSS :hover selector was activating
- Tiny, inactive mobile-only button was clickable
- Fixed duplicate key issue in icon links
2022-12-28 20:19:41 -06:00

25 lines
781 B
TypeScript

import create from "@kodingdotninja/use-tailwind-breakpoint";
import resolveConfig from "tailwindcss/resolveConfig";
import tailwindConfig from "./../../tailwind.config.cjs";
export function classNames(...classes: (string | null | undefined)[]) {
return classes.filter(Boolean).join(" ");
}
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;
}
const config = resolveConfig(tailwindConfig);
export const {useBreakpoint, useBreakpointValue, useBreakpointEffect} = create(config.theme!.screens);