Skip to content
Source
Sign inSign up
pingdotgg/t3code

Render shortcuts with Apple's modifier and key glyphs #4701

Closedcolonelpanic8(GitHub profile, opens in a new tab)wants to merge 3 commits intomain fromrefs/pull/4701/headopened View on GitHub

Showing 3 changed files with 51 additions and 29 deletions (loading 1).

x
0 of 3 viewed, 3 left
3 additions and 18 deletionsapps/web/src/components/settings/KeybindingsSettings.tsxModified
View file
@@ -35,7 +35,7 @@
​
import { isElectron } from "../../env";
import { useOpenInPreferredEditor } from "../../editorPreferences";
-import { formatShortcutLabel } from "../../keybindings";
+import { formatShortcutLabel, formatShortcutTokenLabel } from "../../keybindings";
import { cn } from "../../lib/utils";
import {
primaryServerAvailableEditorsAtom,
@@ -74,26 +74,11 @@
import { useAtomCommand } from "../../state/use-atom-command";
​
function KeybindingPill({ value }: { value: string }) {
- const parts = value.split("+");
return (
<KbdGroup className="bg-transparent p-0 shadow-none">
- {parts.map((part) => (
+ {value.split("+").map((part) => (
<Kbd key={part} className="min-w-6 justify-center px-1.5">
- {part === "mod"
- ? navigator.platform.toLowerCase().includes("mac")
- ? "⌘"
- : "Ctrl"
- : part === "shift"
- ? "⇧"
- : part === "alt"
- ? navigator.platform.toLowerCase().includes("mac")
- ? "⌥"
- : "Alt"