Skip to content

Commit

Permalink
terminal shortcuts
Browse files Browse the repository at this point in the history
  • Loading branch information
danielacorner committed Mar 10, 2023
1 parent c606307 commit ea3fd6b
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/components/Home/HeroVideo.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
18 changes: 9 additions & 9 deletions src/components/Home/PageLinksHorizontal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const GRID_GAP_HZ = 10
const LINK_HEIGHT = 48

export default () => {
const PAGE_LINKS = getPageLinks().slice(1)
const PAGE_LINKS = getPageLinks().slice(1, -1)
const isMounted = useIsMounted()
const trailSpringLeftOnEnter = useTrail(PAGE_LINKS.length, {
transform: `translate(${isMounted ? 0 : 250}px, 0px)`,
Expand Down Expand Up @@ -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={() => {
Expand Down
60 changes: 58 additions & 2 deletions src/shortcuts/terminalShortcuts.jsx
Original file line number Diff line number Diff line change
@@ -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: (
<>
<Code>{`start .`}</Code>
</>
),
shortcutMac: (
<>
<Code>{`open .`}</Code>
</>
),
},
{
description: "Go back to last location",
shortcut: (
<>
<Code>{`cd -`}</Code>
</>
),
},
{
description: "Autocomplete",
shortcut: (
<>
<Tab />
</>
),
},
{
description: "Autocomplete - list all options",
shortcut: (
<>
<Tab />, <Tab />
</>
),
},
{
description: "Reverse search",
shortcut: (
<>
<Ctrl />+<Key>R</Key>
</>
),
},
{
description: "Reverse search - previous match",
shortcut: (
<>
<Ctrl />+<Key>R</Key>, <Ctrl />+<Key>R</Key>
</>
),
},

].map(s => ({ ...s, shortcutMac: s.shortcutMac || s.shortcut })),
bash: [
{
description: "New terminal",
Expand Down Expand Up @@ -35,5 +91,5 @@ export const terminalShortcuts = {
</>
),
},
],
].map(s => ({ ...s, shortcutMac: s.shortcutMac || s.shortcut })),
}
5 changes: 4 additions & 1 deletion src/utils/constants.js → src/utils/constants.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import { GitHub } from "@material-ui/icons"
import React from "react"

export const BREAKPOINTS = {
MOBILE: 480,
TABLET: 800,
Expand All @@ -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: <GitHub style={{ width: "0.5em", height: "0.5em", marginTop: 2 }} />, },
]

export const COLORS = {
Expand Down

0 comments on commit ea3fd6b

Please sign in to comment.