mirror of
https://github.com/Xevion/xevion.dev.git
synced 2025-12-18 14:14:01 -06:00
- 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
25 lines
781 B
TypeScript
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); |