chore: custom command menu shortcut text for macOS (#657)

This commit is contained in:
Ephraim Atta-Duncan
2023-11-17 05:47:19 +00:00
committed by GitHub
parent 8adc44802f
commit cebdf5fd8e

View File

@ -1,6 +1,7 @@
'use client';
import { HTMLAttributes, useState } from 'react';
import type { HTMLAttributes } from 'react';
import { useState } from 'react';
import { Search } from 'lucide-react';
@ -15,6 +16,9 @@ export const DesktopNav = ({ className, ...props }: DesktopNavProps) => {
// const pathname = usePathname();
const [open, setOpen] = useState(false);
const isMacOS = /Macintosh|Mac\s+OS\s+X/i.test(navigator?.userAgent || 'unknown');
const modifierKey = isMacOS ? '⌘' : 'Ctrl';
return (
<div
className={cn('ml-8 hidden flex-1 gap-x-6 md:flex md:justify-center', className)}
@ -34,7 +38,7 @@ export const DesktopNav = ({ className, ...props }: DesktopNavProps) => {
<div>
<div className="text-muted-foreground bg-muted rounded-md px-1.5 py-0.5 font-mono text-xs">
Ctrl+K
{modifierKey}+K
</div>
</div>
</Button>