mirror of
https://github.com/responsively-org/responsively-app
synced 2024-11-10 14:54:12 +00:00
Improvement: removed any updated code
This commit is contained in:
parent
e5b217b949
commit
34e955a369
2 changed files with 39 additions and 1 deletions
|
@ -19,6 +19,10 @@ import Menu from './Menu';
|
|||
import Button from '../Button';
|
||||
import AddressBar from './AddressBar';
|
||||
import ColorSchemeToggle from './ColorSchemeToggle';
|
||||
import ModalLoader from '../ModalLoader';
|
||||
import { PreviewSuiteSelector } from './PreviewSuiteSelector';
|
||||
|
||||
const Divider = () => <div className="h-6 w-px bg-gray-300 dark:bg-gray-700" />;
|
||||
|
||||
const ToolBar = () => {
|
||||
const rotateDevices = useSelector(selectRotate);
|
||||
|
@ -72,15 +76,36 @@ const ToolBar = () => {
|
|||
// Do nothing. Prevent Dialog from closing.
|
||||
};
|
||||
|
||||
function useKey(key: string, cb: () => void) {
|
||||
const callbackRef = useRef(cb);
|
||||
|
||||
useEffect(() => {
|
||||
callbackRef.current = cb;
|
||||
}, [cb]);
|
||||
|
||||
useEffect(() => {
|
||||
function handle(event: { code: string }) {
|
||||
if (event.code === key) {
|
||||
callbackRef.current();
|
||||
}
|
||||
}
|
||||
// current(event)
|
||||
document.addEventListener('keypress', handle);
|
||||
return () => document.removeEventListener('keypress', handle);
|
||||
}, [key]);
|
||||
}
|
||||
function handleInspectShortcut() {
|
||||
dispatch(setIsInspecting(!isInspecting));
|
||||
}
|
||||
// setting shortcut I for inspect element
|
||||
useKey('KeyI', handleInspectShortcut);
|
||||
|
||||
return (
|
||||
<div className="flex items-center justify-between gap-2">
|
||||
<NavigationControls />
|
||||
|
||||
<AddressBar />
|
||||
|
||||
<Button
|
||||
onClick={() => dispatch(setRotate(!rotateDevices))}
|
||||
isActive={rotateDevices}
|
||||
|
|
|
@ -4364,6 +4364,11 @@ clone@^1.0.0, clone@^1.0.2:
|
|||
resolved "https://registry.yarnpkg.com/clone/-/clone-1.0.4.tgz#da309cc263df15994c688ca902179ca3c7cd7c7e"
|
||||
integrity sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg==
|
||||
|
||||
clsx@^1.1.0:
|
||||
version "1.2.1"
|
||||
resolved "https://registry.yarnpkg.com/clsx/-/clsx-1.2.1.tgz#0ddc4a20a549b59c93a4116bb26f5294ca17dc12"
|
||||
integrity sha512-EcR6r5a8bj6pu3ycsa/E/cKVGuTgZJZdsyUYHOksG/UHIiKfjxzRxYJpyVBwYaQeOvghal9fcc4PidlgzugAQg==
|
||||
|
||||
co@^4.6.0:
|
||||
version "4.6.0"
|
||||
resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184"
|
||||
|
@ -11163,7 +11168,7 @@ prompts@^2.0.1:
|
|||
kleur "^3.0.3"
|
||||
sisteransi "^1.0.5"
|
||||
|
||||
prop-types@^15.0.0, prop-types@^15.8.1:
|
||||
prop-types@^15.0.0, prop-types@^15.5.0, prop-types@^15.8.1:
|
||||
version "15.8.1"
|
||||
resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.8.1.tgz#67d87bf1a694f48435cf332c24af10214a3140b5"
|
||||
integrity sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==
|
||||
|
@ -11364,6 +11369,14 @@ react-shallow-renderer@^16.15.0:
|
|||
object-assign "^4.1.1"
|
||||
react-is "^16.12.0 || ^17.0.0 || ^18.0.0"
|
||||
|
||||
react-tabs@^6.0.1:
|
||||
version "6.0.1"
|
||||
resolved "https://registry.yarnpkg.com/react-tabs/-/react-tabs-6.0.1.tgz#3fdb6fd7408f38adfa7b1815b607cd5228e76c8b"
|
||||
integrity sha512-XE5D/iCcwUsr06wf6fWrjA/HbUaj3G2+6NMVJygZuKALHkWYp+D3ZPcG2VctuaOHHzMU48eSOuxwBALBnuXldA==
|
||||
dependencies:
|
||||
clsx "^1.1.0"
|
||||
prop-types "^15.5.0"
|
||||
|
||||
react-test-renderer@^18.2.0:
|
||||
version "18.2.0"
|
||||
resolved "https://registry.yarnpkg.com/react-test-renderer/-/react-test-renderer-18.2.0.tgz#1dd912bd908ff26da5b9fca4fd1c489b9523d37e"
|
||||
|
|
Loading…
Reference in a new issue