|
1 | | -import { |
2 | | - ChevronDownIcon, |
3 | | - ChevronLeftIcon, |
4 | | - ChevronRightIcon, |
5 | | - ChevronUpIcon, |
6 | | -} from "@heroicons/react/20/solid"; |
| 1 | +import { KeyboardDownIcon } from "~/assets/icons/KeyboardDownIcon"; |
| 2 | +import { KeyboardLeftIcon } from "~/assets/icons/KeyboardLeftIcon"; |
| 3 | +import { KeyboardRightIcon } from "~/assets/icons/KeyboardRightIcon"; |
| 4 | +import { KeyboardUpIcon } from "~/assets/icons/KeyboardUpIcon"; |
| 5 | +import { KeyboardWindowsIcon } from "~/assets/icons/KeyboardWindowsIcon"; |
7 | 6 | import { Modifier, Shortcut } from "~/hooks/useShortcutKeys"; |
8 | 7 | import { cn } from "~/utils/cn"; |
9 | 8 | import { useOperatingSystem } from "./OperatingSystemProvider"; |
10 | | -import { KeyboardRightIcon } from "~/assets/icons/KeyboardRightIcon"; |
11 | | -import { KeyboardLeftIcon } from "~/assets/icons/KeyboardLeftIcon"; |
12 | | -import { KeyboardDownIcon } from "~/assets/icons/KeyboardDownIcon"; |
13 | | -import { KeyboardUpIcon } from "~/assets/icons/KeyboardUpIcon"; |
14 | 9 |
|
15 | 10 | const medium = |
16 | 11 | "text-[0.75rem] font-medium min-w-[17px] rounded-[2px] px-1 ml-1 -mr-0.5 flex items-center gap-x-1.5 border border-dimmed/40 text-text-dimmed group-hover:text-text-bright/80 group-hover:border-dimmed/60 transition uppercase"; |
@@ -49,7 +44,9 @@ export function ShortcutKey({ shortcut, variant, className }: ShortcutKeyProps) |
49 | 44 | return ( |
50 | 45 | <span className={cn(variants[variant], className)}> |
51 | 46 | {modifiers.map((k) => ( |
52 | | - <span key={k}>{modifierString(k, isMac)}</span> |
| 47 | + <span key={k}> |
| 48 | + <span>{modifierString(k, isMac)}</span> |
| 49 | + </span> |
53 | 50 | ))} |
54 | 51 | {character && <span>{character}</span>} |
55 | 52 | </span> |
@@ -79,17 +76,17 @@ function keyString(key: String, isMac: boolean, variant: "small" | "medium" | "m |
79 | 76 | } |
80 | 77 | } |
81 | 78 |
|
82 | | -function modifierString(modifier: Modifier, isMac: boolean) { |
| 79 | +function modifierString(modifier: Modifier, isMac: boolean): string | JSX.Element { |
83 | 80 | switch (modifier) { |
84 | 81 | case "alt": |
85 | | - return isMac ? "⌥" : "Alt +"; |
| 82 | + return isMac ? "⌥" : "Alt+"; |
86 | 83 | case "ctrl": |
87 | | - return isMac ? "⌃" : "Ctrl +"; |
| 84 | + return isMac ? "⌃" : "Ctrl+"; |
88 | 85 | case "meta": |
89 | | - return isMac ? "⌘" : "⊞ +"; |
| 86 | + return isMac ? "⌘" : <KeyboardWindowsIcon />; |
90 | 87 | case "shift": |
91 | | - return isMac ? "⇧" : "Shift +"; |
| 88 | + return isMac ? "⇧" : "Shift+"; |
92 | 89 | case "mod": |
93 | | - return isMac ? "⌘" : "Ctrl +"; |
| 90 | + return isMac ? "⌘" : "Ctrl+"; |
94 | 91 | } |
95 | 92 | } |
0 commit comments