Skip to content

Commit

Permalink
feat: add directional arrow keys to kbd component (#305)
Browse files Browse the repository at this point in the history
  • Loading branch information
kylemcd authored Oct 31, 2024
1 parent 26b62b7 commit 6e64eb0
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/hip-bats-burn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@telegraph/kbd": patch
---

add directional arrow keys to kbd
16 changes: 16 additions & 0 deletions packages/kbd/src/Kbd/Kbd.helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,21 @@ export const getIconOrKey = (key: string) => {
return "Ctrl";
}

if (key === "ArrowRight") {
return Lucide.ArrowRight;
}

if (key === "ArrowLeft") {
return Lucide.ArrowLeft;
}

if (key === "ArrowDown") {
return Lucide.ArrowDown;
}

if (key === "ArrowUp") {
return Lucide.ArrowUp;
}

return key.length === 1 ? key.toUpperCase() : key;
};

0 comments on commit 6e64eb0

Please sign in to comment.