Skip to content

Commit 9af728a

Browse files
committed
feat: command listener now works on both ctrl and alt keys.
Fixes #6
1 parent ec7dfb8 commit 9af728a

File tree

2 files changed

+9
-21
lines changed

2 files changed

+9
-21
lines changed

src/context/CommandPaletteContext.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export const CommandPaletteProvider = ({ children }) => {
1616
// Global keyboard shortcut
1717
useEffect(() => {
1818
const handleKeyDown = (event) => {
19-
if (event.altKey && event.key === 'k') {
19+
if ( (event.altKey && event.key === 'k') || (event.ctrlKey && event.key === 'k') ) {
2020
event.preventDefault();
2121
togglePalette();
2222
}

src/pages/CommandsPage.js

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { Link } from 'react-router-dom';
33
import { ArrowLeftIcon, TerminalWindowIcon } from '@phosphor-icons/react';
44
import useSeo from '../hooks/useSeo';
55
import { useCommandPalette } from '../context/CommandPaletteContext';
6-
import colors from '../config/colors';
76

87
const commandsData = [
98
{
@@ -353,19 +352,12 @@ function CommandsPage() {
353352
ogImage: '/images/ogtitle.png',
354353
twitterCard: 'summary_large_image',
355354
twitterTitle: 'All Commands | Fezcodex',
356-
twitterDescription:
357-
'All the available commands that can be used in Fezcodex.',
355+
twitterDescription: 'All the available commands that can be used in Fezcodex.',
358356
twitterImage: '/images/ogtitle.png',
359357
});
360358

361359
const { togglePalette } = useCommandPalette();
362360

363-
const cardStyle = {
364-
backgroundColor: colors['app-alpha-10'],
365-
borderColor: colors['app-alpha-50'],
366-
color: colors.app,
367-
};
368-
369361
return (
370362
<div className="py-16 sm:py-24">
371363
<div className="mx-auto max-w-7xl px-6 lg:px-8">
@@ -391,8 +383,7 @@ function CommandsPage() {
391383
</div>
392384
<div className="flex justify-center items-center mt-16">
393385
<div
394-
className="group bg-transparent border rounded-lg shadow-2xl p-6 flex flex-col justify-between relative transform overflow-hidden h-full w-full max-w-4xl"
395-
style={cardStyle}
386+
className="group bg-[#1A2E1A50] rounded-[0.25rem] border border-neutral-700 shadow-2xl p-6 flex flex-col justify-between relative transform overflow-hidden h-full w-full max-w-4xl"
396387
>
397388
<div
398389
className="absolute top-0 left-0 w-full h-full opacity-10"
@@ -403,16 +394,14 @@ function CommandsPage() {
403394
}}
404395
></div>
405396
<div className="relative z-10 p-1 font-mono">
406-
<h1 className="text-3xl font-arvo font-normal mb-4 text-app">
407-
{' '}
408-
Command Palette{' '}
397+
<h1 className="text-3xl font-playfairDisplay font-normal mb-4 text-lime-200">
398+
Command Palette
409399
</h1>
410400
<hr className="border-gray-700 mb-4" />
411401

412402
<div className="mb-6 ml-4 mr-4">
413403
<p className="text-gray-200 mb-4">
414-
Press <kbd className="kbd kbd-sm text-emerald-300">Alt</kbd>+
415-
<kbd className="kbd kbd-sm text-emerald-300">K</kbd> to open
404+
Press <kbd className="kbd kbd-sm text-black border rounded-lg px-1 bg-gray-200">Alt/Ctrl</kbd> + <kbd className="kbd kbd-sm text-black border rounded-lg px-1 bg-gray-200">K</kbd> to open
416405
Commands Palette. It lists all available
417406
<code className="text-red-400"> PAGE</code>,
418407
<code className="text-red-400"> POST</code>,
@@ -436,15 +425,14 @@ function CommandsPage() {
436425
</button>
437426
</div>
438427

439-
<h1 className="text-3xl font-arvo font-normal mb-4 text-app">
440-
{' '}
441-
Available Commands{' '}
428+
<h1 className="text-3xl font-playfairDisplay font-normal mb-4 text-app">
429+
Available Commands
442430
</h1>
443431
<hr className="border-gray-700 mb-6" />
444432

445433
{commandsData.map((category, catIndex) => (
446434
<div key={catIndex} className="mb-8">
447-
<h2 className="text-2xl font-semibold text-gray-200 mb-4 border-b border-gray-700 pb-2 inline-block">
435+
<h2 className="text-2xl font-playfairDisplay font-semibold text-gray-200 mb-4 border-b border-gray-700 pb-2 inline-block">
448436
{category.category}
449437
</h2>
450438
<div className="grid grid-cols-1 gap-4">

0 commit comments

Comments
 (0)