mirror of
https://github.com/responsively-org/responsively-app
synced 2024-11-10 14:54:12 +00:00
improvement!: changed I as Shortcut for Inspect
Refactored inspect element shortcut to I and implemented suggested changes
This commit is contained in:
parent
7413a9a13e
commit
8c307fa31d
1 changed files with 7 additions and 6 deletions
|
@ -13,14 +13,15 @@ import Button from '../Button';
|
|||
import AddressBar from './AddressBar';
|
||||
import ColorSchemeToggle from './ColorSchemeToggle';
|
||||
|
||||
function useKey(key, cb) {
|
||||
function useKey(key: any, cb: any) {
|
||||
const callbackRef = useRef(cb);
|
||||
useEffect(() => {
|
||||
callbackRef.current = cb;
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
function handle(event) {
|
||||
callbackRef.current = cb;
|
||||
}, [cb]);
|
||||
|
||||
useEffect(() => {
|
||||
function handle(event: { code: any }) {
|
||||
if (event.code === key) {
|
||||
callbackRef.current(event);
|
||||
}
|
||||
|
@ -37,7 +38,7 @@ const ToolBar = () => {
|
|||
function handleInspectShortcut() {
|
||||
dispatch(setIsInspecting(!isInspecting));
|
||||
}
|
||||
useKey('KeyS', handleInspectShortcut);
|
||||
useKey('KeyI', handleInspectShortcut);
|
||||
|
||||
return (
|
||||
<div className="flex items-center justify-between gap-2">
|
||||
|
|
Loading…
Reference in a new issue