diff --git a/components/Settings.js b/components/Settings.js index 8eee729..bc4b28a 100644 --- a/components/Settings.js +++ b/components/Settings.js @@ -1,5 +1,6 @@ import React from 'react' import omitBy from 'lodash.omitby' +import { useKeyboardListener } from '@dawnlabs/tacklebox' import ThemeSelect from './ThemeSelect' import FontSelect from './FontSelect' @@ -14,6 +15,15 @@ import { COLORS, DEFAULT_PRESETS } from '../lib/constants' import { toggle, getPresets, savePresets, generateId, fileToJSON } from '../lib/util' import SettingsIcon from './svg/Settings' +function KeyboardShortcut({ handle }) { + useKeyboardListener('/', e => { + if (e.metaKey) { + handle() + } + }) + return null +} + const WindowSettings = React.memo( ({ onChange, @@ -233,6 +243,7 @@ class Settings extends React.PureComponent { } settingsRef = React.createRef() + menuRef = React.createRef() componentDidMount() { const storedPresets = getPresets(localStorage) || [] @@ -376,6 +387,14 @@ class Settings extends React.PureComponent { return (