fix: Bag 'o fixes
Remove menu hover styles on mobile Fixed duplicate hover+active behavior on editor menus Fixed editor menus visibly scroll to the top when reopened Fixed some minor editor spacing issues Renamed shred routeHelpers -> urlHelpers
This commit is contained in:
17
app/utils/browser.ts
Normal file
17
app/utils/browser.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
* Returns true if the client is a touch device.
|
||||
*/
|
||||
export function isTouchDevice(): boolean {
|
||||
if (typeof window === "undefined") {
|
||||
return false;
|
||||
}
|
||||
return window.matchMedia?.("(hover: none) and (pointer: coarse)")?.matches;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the client is running on a Mac.
|
||||
*/
|
||||
export function isMac(): boolean {
|
||||
const SSR = typeof window === "undefined";
|
||||
return !SSR && window.navigator.platform === "MacIntel";
|
||||
}
|
||||
@@ -1,11 +1,11 @@
|
||||
const isMac = window.navigator.platform === "MacIntel";
|
||||
import { isMac } from "~/utils/browser";
|
||||
|
||||
export const metaDisplay = isMac ? "⌘" : "Ctrl";
|
||||
export const metaDisplay = isMac() ? "⌘" : "Ctrl";
|
||||
|
||||
export const meta = isMac ? "cmd" : "ctrl";
|
||||
export const meta = isMac() ? "cmd" : "ctrl";
|
||||
|
||||
export function isModKey(
|
||||
event: KeyboardEvent | MouseEvent | React.KeyboardEvent
|
||||
) {
|
||||
return isMac ? event.metaKey : event.ctrlKey;
|
||||
return isMac() ? event.metaKey : event.ctrlKey;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user