From dafb0227149b6d8b32908ec1196b298dfa4d4209 Mon Sep 17 00:00:00 2001 From: "daniel.corner" Date: Fri, 10 Mar 2023 00:17:52 -0500 Subject: [PATCH] terminal shortcuts --- src/components/Home/HeroVideo.jsx | 4 +- src/components/Home/PageLinksHorizontal.jsx | 16 +++--- src/shortcuts/terminalShortcuts.jsx | 60 ++++++++++++++++++++- src/utils/{constants.js => constants.jsx} | 5 +- 4 files changed, 72 insertions(+), 13 deletions(-) rename src/utils/{constants.js => constants.jsx} (79%) diff --git a/src/components/Home/HeroVideo.jsx b/src/components/Home/HeroVideo.jsx index d8bea38..97af0ec 100644 --- a/src/components/Home/HeroVideo.jsx +++ b/src/components/Home/HeroVideo.jsx @@ -145,12 +145,12 @@ const HeroStyles = styled.section` } ` -const isBraveBrowser = (navigator.brave && await navigator.brave.isBrave() || false) +const isBraveBrowser = (async () => ((navigator.brave && await navigator.brave.isBrave() || false)))() export default () => { const isTabletOrLarger = useMediaQuery(`(min-width:${BREAKPOINTS.TABLET}px)`) const doesFitFullWidthTitle = useMediaQuery(`(min-width:${914}px)`) - const isSlowNetwork = navigator?.connection?.downlink && navigator.connection.downlink < 5 + const isSlowNetwork = typeof window !== 'undefined' && navigator?.connection?.downlink && navigator.connection.downlink < 5 const data = useStaticQuery(graphql` query { site { diff --git a/src/components/Home/PageLinksHorizontal.jsx b/src/components/Home/PageLinksHorizontal.jsx index a31f498..e3a0b11 100644 --- a/src/components/Home/PageLinksHorizontal.jsx +++ b/src/components/Home/PageLinksHorizontal.jsx @@ -39,14 +39,14 @@ export default () => { style={{ ...(isMousedOverIdx === idx ? { - transform: `scale(${1.07 + - randomNumbers[0] * 0.5 - - 0.2}) translateY(-3px) rotate(${rotateDeg}deg)`, - color: `hsl(${randomNumbers[0] * 360},90%,80%)`, - borderColor: `hsl(${randomNumbers[1] * 360},90%,80%)`, - boxShadow: `0px 0px 20px 0px hsla(${randomNumbers[2] * - 360}, 67%, 82%, 0.56)`, - } + transform: `scale(${1.07 + + randomNumbers[0] * 0.5 - + 0.2}) translateY(-3px) rotate(${rotateDeg}deg)`, + color: `hsl(${randomNumbers[0] * 360},90%,80%)`, + borderColor: `hsl(${randomNumbers[1] * 360},90%,80%)`, + boxShadow: `0px 0px 20px 0px hsla(${randomNumbers[2] * + 360}, 67%, 82%, 0.56)`, + } : {}), }} onMouseEnter={() => { diff --git a/src/shortcuts/terminalShortcuts.jsx b/src/shortcuts/terminalShortcuts.jsx index cf8f0b2..e3356ee 100644 --- a/src/shortcuts/terminalShortcuts.jsx +++ b/src/shortcuts/terminalShortcuts.jsx @@ -1,7 +1,63 @@ import React from "react" -import { Alt, Key, Ctrl, Shift } from "../components/Keyboard/Keys" +import { Alt, Key, Ctrl, Shift, Tab, Code } from "../components/Keyboard/Keys" export const terminalShortcuts = { + "Navigation": [ + { + description: "Open File Explorer here", + shortcut: ( + <> + {`start .`} + + ), + shortcutMac: ( + <> + {`open .`} + + ), + }, + { + description: "Go back to last location", + shortcut: ( + <> + {`cd -`} + + ), + }, + { + description: "Autocomplete", + shortcut: ( + <> + + + ), + }, + { + description: "Autocomplete - list all options", + shortcut: ( + <> + , + + ), + }, + { + description: "Reverse search", + shortcut: ( + <> + +R + + ), + }, + { + description: "Reverse search - previous match", + shortcut: ( + <> + +R, +R + + ), + }, + + ].map(s => ({ ...s, shortcutMac: s.shortcutMac || s.shortcut })), bash: [ { description: "New terminal", @@ -35,5 +91,5 @@ export const terminalShortcuts = { ), }, - ], + ].map(s => ({ ...s, shortcutMac: s.shortcutMac || s.shortcut })), } diff --git a/src/utils/constants.js b/src/utils/constants.jsx similarity index 79% rename from src/utils/constants.js rename to src/utils/constants.jsx index bc28d1c..dc1d1f8 100644 --- a/src/utils/constants.js +++ b/src/utils/constants.jsx @@ -1,3 +1,6 @@ +import { GitHub } from "@material-ui/icons" +import React from "react" + export const BREAKPOINTS = { MOBILE: 480, TABLET: 800, @@ -12,7 +15,7 @@ export const getPageLinks = () => [ { to: "/mac", title: "Mac" }, { to: "/vs-code", title: "VS Code" }, { to: "/terminal", title: "Terminal" }, - { to: "https://github.com/danielacorner/", title: "whoami" }, + { to: "https://github.com/danielacorner/shortcutslist", title: , }, ] export const COLORS = {