Move nav files to content dir
Luke Karrys committed
Oct 15, 2023 at 22:54 UTC
e726829cfc38317ec7164646f9dd38966415b3b1
9 files changed
+33
-34
.prettierignore
renamed
CONTRIBUTING.md
+1
-1
@@ -108,7 +108,7 @@ The content pages should include [frontmatter](https://jekyllrb.com/docs/front-m
108
109
## Navigation
110
111
-The site's navigation (on the left-hand sidebar of the site) is controlled by `src/nav.yml`. If you add or remove a page from the site, you'll also want to add or remove it from the navigation configuration.
111
+The site's navigation (on the left-hand sidebar of the site) is controlled by `content/nav.yml`. If you add or remove a page from the site, you'll also want to add or remove it from the navigation configuration.
112
113
## CLI
114
content/header-nav.yml
renamed
content/nav.yml
renamed
src/components/header.js
+2
-2
@@ -6,9 +6,9 @@ import MobileSearch from './mobile-search'
6
import NavDrawer from './nav-drawer'
7
import Search from './search'
8
import useSearch from '../hooks/use-search'
9
-import useSiteMetadata from '../hooks/use-site-metadata'
10
-import headerNavItems from '../header-nav.yml'
9
import {HEADER_HEIGHT, NPM_RED} from '../constants'
10
+import useSiteMetadata from '../hooks/use-site-metadata'
11
+import headerNavItems from '../../content/header-nav.yml'
12
13
const NpmHeaderBar = styled(Box)`
14
height: 10px;
src/components/nav-drawer.js
+1
-1
@@ -4,9 +4,9 @@ import {XIcon, ThreeBarsIcon} from '@primer/octicons-react'
4
import {Link as GatsbyLink} from 'gatsby'
5
import Drawer from './drawer'
6
import NavItems from './nav-items'
7
-import headerNavItems from '../header-nav.yml'
7
import useSiteMetadata from '../hooks/use-site-metadata'
8
import {useIsMobile} from '../hooks/use-breakpoint'
9
+import headerNavItems from '../../content/header-nav.yml'
10
11
const useDrawerIsOpen = () => {
12
const isMobile = useIsMobile()
src/components/variant-select.js
+7
-4
@@ -1,26 +1,29 @@
1
import React from 'react'
2
import {ActionList, ActionMenu, Box} from '@primer/react'
3
+import {navigate} from 'gatsby'
4
import getNav from '../util/get-nav'
5
import {useLocation} from '../layout'
6
7
const VariantItem = ({match, active}) => {
8
const {variant, page} = match
9
10
+ const navigateToPage = React.useCallback(() => navigate(`${page.url}?v=true`), [page.url])
11
+
12
const handleClick = React.useCallback(
13
event => {
14
event.preventDefault()
12
- window.location.href = `${page.url}?v=true`
15
+ navigateToPage()
16
},
14
- [page.url],
17
+ [navigateToPage],
18
)
19
20
const handleKey = React.useCallback(
21
event => {
22
if (event.key === 'Enter') {
20
- window.location.href = `${page.url}?v=true`
23
+ navigateToPage()
24
}
25
},
23
- [page.url],
26
+ [navigateToPage],
27
)
28
29
return (
src/shared.js
+21
-25
@@ -84,18 +84,16 @@ const shared = {
84
},
85
'connect-to-accounts': {
86
text: (
87
- <>
88
- <ul>
89
- <li>
90
- If you have previously linked a GitHub account to your npm account, select{' '}
91
- <strong>Connect to GitHub</strong>. This will help our support team verify your account.
92
- </li>
93
- <li>
94
- If you have previously linked a Twitter account to your npm account, select{' '}
95
- <strong>Connect to Twitter</strong>. This will help our support team verify your account.
96
- </li>
97
- </ul>
98
- </>
87
+ <ul>
88
+ <li>
89
+ If you have previously linked a GitHub account to your npm account, select <strong>Connect to GitHub</strong>.
90
+ This will help our support team verify your account.
91
+ </li>
92
+ <li>
93
+ If you have previously linked a Twitter account to your npm account, select{' '}
94
+ <strong>Connect to Twitter</strong>. This will help our support team verify your account.
95
+ </li>
96
+ </ul>
97
),
98
},
99
'submit-support-ticket': {
@@ -380,19 +378,17 @@ const shared = {
378
'enterprise-migration-requirements': {
379
text: (
380
<Note>
383
- <>
384
- <strong>Note:</strong> Using{' '}
385
- <code>
386
- <a href="https://www.npmjs.com/package/pneumatic-tubes">pneumatic-tubes</a>
387
- </code>{' '}
388
- for migration requires{' '}
389
- <ul>
390
- <li>Node 8+</li>
391
- <li>
392
- npm 5+ (to install or upgrade, run <code>npm install npm@latest -g</code>)
393
- </li>
394
- </ul>
395
- </>
381
+ <strong>Note:</strong> Using{' '}
382
+ <code>
383
+ <a href="https://www.npmjs.com/package/pneumatic-tubes">pneumatic-tubes</a>
384
+ </code>{' '}
385
+ for migration requires{' '}
386
+ <ul>
387
+ <li>Node 8+</li>
388
+ <li>
389
+ npm 5+ (to install or upgrade, run <code>npm install npm@latest -g</code>)
390
+ </li>
391
+ </ul>
392
</Note>
393
),
394
},
src/util/get-nav.js
+1
-1
@@ -1,5 +1,5 @@
1
import {withPrefix} from 'gatsby'
2
-import navItems from '../nav.yml'
2
+import navItems from '../../content/nav.yml'
3
4
const NavHierarchy = {
5
getLocation(path) {