diff --git a/src/components/SearchButton.tsx b/src/components/SearchButton.tsx index d650497b..63fd1e30 100644 --- a/src/components/SearchButton.tsx +++ b/src/components/SearchButton.tsx @@ -2,6 +2,7 @@ import * as React from 'react' import { Command, Search } from 'lucide-react' import { twMerge } from 'tailwind-merge' import { useSearchContext } from '~/contexts/SearchContext' +import { usePlatform } from '~/hooks/usePlatform' interface SearchButtonProps { className?: string @@ -10,6 +11,7 @@ interface SearchButtonProps { export function SearchButton({ className }: SearchButtonProps) { const { openSearch } = useSearchContext() + const platform = usePlatform(); return ( ) diff --git a/src/hooks/usePlatform.ts b/src/hooks/usePlatform.ts new file mode 100644 index 00000000..f30ade1d --- /dev/null +++ b/src/hooks/usePlatform.ts @@ -0,0 +1,6 @@ +export function usePlatform() { + if (typeof navigator === "undefined") { + return; + } + return navigator.platform; +} \ No newline at end of file