1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-11-01 19:07:38 +01:00
unleash.unleash/frontend/src/hooks/useIsAppleDevice.ts
Tymoteusz Czech 53b12604b8 Search keyboard shortcut (#1048)
* feat: search keyboard shortcut

* fix: search input placeholder snapshot update

* fix: update apple device recognition

Co-authored-by: Nuno Góis <github@nunogois.com>

* refactor: return hotkey from useKeyboardShortcut

* fix: don't close non-empty search field

* Archive table
new sort parameter

* Revert "Archive table"

This reverts commit 171806352c2a01ce439ce7bd77476797d544275c.

* update search field focus

* refactor: clarify hotkey description

* fix: make variant payload text box multiline (#1060)

* fix: make variant payload text box multiline

* refactor: adjust min/max rows

* refactor: use fixed number of rows to avoid MUI render loop bug

* fix: toggle search on escape only in focused

* fix: add hotkey to custom placeholders

Co-authored-by: Nuno Góis <github@nunogois.com>
Co-authored-by: andreas-unleash <andreas@getunleash.ai>
Co-authored-by: olav <mail@olav.io>
2022-06-06 14:23:48 +02:00

25 lines
643 B
TypeScript

import { useEffect, useState } from 'react';
export const useIsAppleDevice = () => {
const [isAppleDevice, setIsAppleDevice] = useState<boolean>();
useEffect(() => {
const platform =
(
navigator as unknown as {
userAgentData: { platform: string };
}
)?.userAgentData?.platform ||
navigator?.platform ||
'unknown';
setIsAppleDevice(
platform.toLowerCase().includes('mac') ||
platform === 'iPhone' ||
platform === 'iPad'
);
}, []);
return isAppleDevice;
};