Skip to content

Commit

Permalink
refactor: Update keyboard shortcuts in Playground component
Browse files Browse the repository at this point in the history
  • Loading branch information
HasanYahya101 committed Jul 23, 2024
1 parent 2551f5f commit 62e2ec9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/components/component/playground.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ export function Playground() {
const copyHEXShortcut = isMac ? "⌘Z" : "Ctrl+Z";
const copyRGBShortcut = isMac ? "⌘X" : "Ctrl+X";
const copyHSLShortcut = isMac ? "⌘C" : "Ctrl+C";
const switchShortcut = isMac ? "⌘V" : "Ctrl+V";
const switchShortcut = isMac ? "⌘M" : "Ctrl+M";

const handleShortcuts = (e) => {
const ctrlKey = e.metaKey || e.ctrlKey;
Expand All @@ -338,7 +338,7 @@ export function Playground() {
const ZKey = e.key === "z" || e.key === "Z";
const XKey = e.key === "x" || e.key === "X";
const CKey = e.key === "c" || e.key === "C";
const VKey = e.key === "v" || e.key === "V";
const MKey = e.key === "m" || e.key === "M";
if (ctrlKey && ZKey && !shiftKey && !altKey) {
e.preventDefault();
CopyHEX();
Expand All @@ -348,7 +348,7 @@ export function Playground() {
} else if (ctrlKey && CKey && !shiftKey && !altKey) {
e.preventDefault();
CopyHSL();
} else if (ctrlKey && VKey && !shiftKey && !altKey) {
} else if (ctrlKey && MKey && !shiftKey && !altKey) {
e.preventDefault();
switchMode();
}
Expand Down

0 comments on commit 62e2ec9

Please sign in to comment.