Skip to content

Commit ea3fd6b

Browse files
committed
terminal shortcuts
1 parent c606307 commit ea3fd6b

File tree

4 files changed

+73
-14
lines changed

4 files changed

+73
-14
lines changed

src/components/Home/HeroVideo.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,12 +145,12 @@ const HeroStyles = styled.section`
145145
}
146146
`
147147

148-
const isBraveBrowser = (navigator.brave && await navigator.brave.isBrave() || false)
148+
const isBraveBrowser = (async () => ((navigator.brave && await navigator.brave.isBrave() || false)))()
149149

150150
export default () => {
151151
const isTabletOrLarger = useMediaQuery(`(min-width:${BREAKPOINTS.TABLET}px)`)
152152
const doesFitFullWidthTitle = useMediaQuery(`(min-width:${914}px)`)
153-
const isSlowNetwork = navigator?.connection?.downlink && navigator.connection.downlink < 5
153+
const isSlowNetwork = typeof window !== 'undefined' && navigator?.connection?.downlink && navigator.connection.downlink < 5
154154
const data = useStaticQuery(graphql`
155155
query {
156156
site {

src/components/Home/PageLinksHorizontal.jsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const GRID_GAP_HZ = 10
99
const LINK_HEIGHT = 48
1010

1111
export default () => {
12-
const PAGE_LINKS = getPageLinks().slice(1)
12+
const PAGE_LINKS = getPageLinks().slice(1, -1)
1313
const isMounted = useIsMounted()
1414
const trailSpringLeftOnEnter = useTrail(PAGE_LINKS.length, {
1515
transform: `translate(${isMounted ? 0 : 250}px, 0px)`,
@@ -39,14 +39,14 @@ export default () => {
3939
style={{
4040
...(isMousedOverIdx === idx
4141
? {
42-
transform: `scale(${1.07 +
43-
randomNumbers[0] * 0.5 -
44-
0.2}) translateY(-3px) rotate(${rotateDeg}deg)`,
45-
color: `hsl(${randomNumbers[0] * 360},90%,80%)`,
46-
borderColor: `hsl(${randomNumbers[1] * 360},90%,80%)`,
47-
boxShadow: `0px 0px 20px 0px hsla(${randomNumbers[2] *
48-
360}, 67%, 82%, 0.56)`,
49-
}
42+
transform: `scale(${1.07 +
43+
randomNumbers[0] * 0.5 -
44+
0.2}) translateY(-3px) rotate(${rotateDeg}deg)`,
45+
color: `hsl(${randomNumbers[0] * 360},90%,80%)`,
46+
borderColor: `hsl(${randomNumbers[1] * 360},90%,80%)`,
47+
boxShadow: `0px 0px 20px 0px hsla(${randomNumbers[2] *
48+
360}, 67%, 82%, 0.56)`,
49+
}
5050
: {}),
5151
}}
5252
onMouseEnter={() => {

src/shortcuts/terminalShortcuts.jsx

Lines changed: 58 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,63 @@
11
import React from "react"
2-
import { Alt, Key, Ctrl, Shift } from "../components/Keyboard/Keys"
2+
import { Alt, Key, Ctrl, Shift, Tab, Code } from "../components/Keyboard/Keys"
33

44
export const terminalShortcuts = {
5+
"Navigation": [
6+
{
7+
description: "Open File Explorer here",
8+
shortcut: (
9+
<>
10+
<Code>{`start .`}</Code>
11+
</>
12+
),
13+
shortcutMac: (
14+
<>
15+
<Code>{`open .`}</Code>
16+
</>
17+
),
18+
},
19+
{
20+
description: "Go back to last location",
21+
shortcut: (
22+
<>
23+
<Code>{`cd -`}</Code>
24+
</>
25+
),
26+
},
27+
{
28+
description: "Autocomplete",
29+
shortcut: (
30+
<>
31+
<Tab />
32+
</>
33+
),
34+
},
35+
{
36+
description: "Autocomplete - list all options",
37+
shortcut: (
38+
<>
39+
<Tab />, <Tab />
40+
</>
41+
),
42+
},
43+
{
44+
description: "Reverse search",
45+
shortcut: (
46+
<>
47+
<Ctrl />+<Key>R</Key>
48+
</>
49+
),
50+
},
51+
{
52+
description: "Reverse search - previous match",
53+
shortcut: (
54+
<>
55+
<Ctrl />+<Key>R</Key>, <Ctrl />+<Key>R</Key>
56+
</>
57+
),
58+
},
59+
60+
].map(s => ({ ...s, shortcutMac: s.shortcutMac || s.shortcut })),
561
bash: [
662
{
763
description: "New terminal",
@@ -35,5 +91,5 @@ export const terminalShortcuts = {
3591
</>
3692
),
3793
},
38-
],
94+
].map(s => ({ ...s, shortcutMac: s.shortcutMac || s.shortcut })),
3995
}
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
import { GitHub } from "@material-ui/icons"
2+
import React from "react"
3+
14
export const BREAKPOINTS = {
25
MOBILE: 480,
36
TABLET: 800,
@@ -12,7 +15,7 @@ export const getPageLinks = () => [
1215
{ to: "/mac", title: "Mac" },
1316
{ to: "/vs-code", title: "VS Code" },
1417
{ to: "/terminal", title: "Terminal" },
15-
{ to: "https://github.com/danielacorner/", title: "whoami" },
18+
{ to: "https://github.com/danielacorner/shortcutslist", title: <GitHub style={{ width: "0.5em", height: "0.5em", marginTop: 2 }} />, },
1619
]
1720

1821
export const COLORS = {

0 commit comments

Comments
 (0)