-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
163 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { MdKeyboardCommandKey } from 'react-icons/md/index'; | ||
|
||
import { Item } from '../item'; | ||
|
||
interface ShortcutsProps { | ||
open: () => void; | ||
} | ||
|
||
export function Shortcuts({ open }: ShortcutsProps) { | ||
return ( | ||
<Item | ||
icon={<MdKeyboardCommandKey />} | ||
label="Shortcuts" | ||
shortcut="Shift + H" | ||
onClick={open} | ||
/> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { ShortcutsModal } from './shortcuts'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
.heading { | ||
margin-bottom: 20px; | ||
font-family: var(--font-heading); | ||
font-size: var(--font-md); | ||
font-weight: 600; | ||
} | ||
|
||
.shortcuts { | ||
display: flex; | ||
flex-direction: column; | ||
row-gap: 12px; | ||
} | ||
|
||
.row { | ||
display: flex; | ||
column-gap: 12px; | ||
align-items: center; | ||
justify-content: space-between; | ||
|
||
& .label { | ||
font-weight: 500; | ||
color: var(--color-foreground-subtle); | ||
} | ||
|
||
& .divider { | ||
flex-grow: 1; | ||
height: 1px; | ||
background-color: var(--color-neutral-200); | ||
} | ||
|
||
& .keys { | ||
display: flex; | ||
column-gap: 8px; | ||
align-items: center; | ||
} | ||
} | ||
|
||
.key { | ||
padding: 6px 8px; | ||
font-size: var(--font-2xsm); | ||
background-color: var(--color-neutral-100); | ||
border: 1px solid var(--color-neutral-200); | ||
border-radius: 4px; | ||
box-shadow: | ||
inset 0 1px 1px var(--color-neutral-400), | ||
inset 0 -2px 0 var(--color-neutral-50); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
import { Modal } from '@/components/modal'; | ||
|
||
import styles from './shortcuts.module.css'; | ||
|
||
interface ShortcutsModalProps { | ||
onClose: () => void; | ||
show: boolean; | ||
} | ||
|
||
export function ShortcutsModal({ onClose, show }: ShortcutsModalProps) { | ||
const shortcuts = [ | ||
{ | ||
keys: ['Shift', 'H'], | ||
label: 'Shortcuts List', | ||
}, | ||
{ | ||
keys: ['Shift', 'Alt', 'P'], | ||
label: 'Presets', | ||
}, | ||
{ | ||
keys: ['Shift', 'S'], | ||
label: 'Share Sounds', | ||
}, | ||
{ | ||
keys: ['Shift', 'N'], | ||
label: 'Notepad', | ||
}, | ||
{ | ||
keys: ['Shift', 'P'], | ||
label: 'Pomodoro Timer', | ||
}, | ||
{ | ||
keys: ['Shift', 'Space'], | ||
label: 'Toggle Play', | ||
}, | ||
{ | ||
keys: ['Shift', 'R'], | ||
label: 'Unselect All Sounds', | ||
}, | ||
]; | ||
|
||
return ( | ||
<Modal show={show} onClose={onClose}> | ||
<h1 className={styles.heading}>Keyboard Shortcuts</h1> | ||
<div className={styles.shortcuts}> | ||
{shortcuts.map(shortcut => ( | ||
<Row | ||
key={shortcut.label} | ||
keys={shortcut.keys} | ||
label={shortcut.label} | ||
/> | ||
))} | ||
</div> | ||
</Modal> | ||
); | ||
} | ||
|
||
interface RowProps { | ||
keys: Array<string>; | ||
label: string; | ||
} | ||
|
||
function Row({ keys, label }: RowProps) { | ||
return ( | ||
<div className={styles.row}> | ||
<p className={styles.label}>{label}</p> | ||
<div className={styles.divider} /> | ||
<div className={styles.keys}> | ||
{keys.map(key => ( | ||
<Key key={`${label}-${key}`}>{key}</Key> | ||
))} | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
interface KeyProps { | ||
children: React.ReactNode; | ||
} | ||
|
||
function Key({ children }: KeyProps) { | ||
return <div className={styles.key}>{children}</div>; | ||
} |