@primer/gatsby-theme-doctocat 4.6.1 → 4.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/package.json +1 -1
- package/src/components/header.js +9 -3
- package/src/use-path-prefix.js +14 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @primer/gatsby-theme-doctocat
|
|
2
2
|
|
|
3
|
+
## 4.6.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`545c1ef`](https://github.com/primer/doctocat/commit/545c1ef96087e3da1990c206e484f0bd06e5eb39) [#618](https://github.com/primer/doctocat/pull/618) Thanks [@josepmartins](https://github.com/josepmartins)! - Add missing `pathPrefix`` to the selected state in Underlinenav items
|
|
8
|
+
|
|
3
9
|
## 4.6.1
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/package.json
CHANGED
package/src/components/header.js
CHANGED
|
@@ -5,6 +5,7 @@ import {Link as GatsbyLink} from 'gatsby'
|
|
|
5
5
|
import React from 'react'
|
|
6
6
|
import primerNavItems from '../primer-nav.yml'
|
|
7
7
|
import useSiteMetadata from '../use-site-metadata'
|
|
8
|
+
import usePathPrefix from '../use-path-prefix'
|
|
8
9
|
import MobileSearch from './mobile-search'
|
|
9
10
|
import NavDrawer, {useNavDrawerState} from './nav-drawer'
|
|
10
11
|
import Search from './search'
|
|
@@ -17,6 +18,7 @@ function Header({isSearchEnabled, path}) {
|
|
|
17
18
|
const [isNavDrawerOpen, setIsNavDrawerOpen] = useNavDrawerState(theme.breakpoints[2])
|
|
18
19
|
const [isMobileSearchOpen, setIsMobileSearchOpen] = React.useState(false)
|
|
19
20
|
const siteMetadata = useSiteMetadata()
|
|
21
|
+
const pathPrefix = usePathPrefix()
|
|
20
22
|
|
|
21
23
|
return (
|
|
22
24
|
<ThemeProvider>
|
|
@@ -92,7 +94,7 @@ function Header({isSearchEnabled, path}) {
|
|
|
92
94
|
</Box>
|
|
93
95
|
<Box>
|
|
94
96
|
<Box sx={{display: ['none', null, null, 'flex'], alignItems: 'center'}}>
|
|
95
|
-
<PrimerNavItems path={path} siteMetadata={siteMetadata} items={primerNavItems} />
|
|
97
|
+
<PrimerNavItems path={path} siteMetadata={siteMetadata} pathPrefix={pathPrefix} items={primerNavItems} />
|
|
96
98
|
{isSearchEnabled ? (
|
|
97
99
|
<Box sx={{display: ['none', null, null, 'block'], ml: 3}}>
|
|
98
100
|
<Search />
|
|
@@ -138,7 +140,11 @@ Header.defaultProps = {
|
|
|
138
140
|
isSearchEnabled: true
|
|
139
141
|
}
|
|
140
142
|
|
|
141
|
-
function PrimerNavItems({siteMetadata, items, path}) {
|
|
143
|
+
function PrimerNavItems({siteMetadata, items, path, pathPrefix}) {
|
|
144
|
+
console.log('header url', siteMetadata.header.url)
|
|
145
|
+
console.log('pathPrefix', pathPrefix)
|
|
146
|
+
console.log('path', path)
|
|
147
|
+
|
|
142
148
|
return (
|
|
143
149
|
<>
|
|
144
150
|
<VisuallyHidden>
|
|
@@ -150,7 +156,7 @@ function PrimerNavItems({siteMetadata, items, path}) {
|
|
|
150
156
|
<UnderlineNav.Link
|
|
151
157
|
key={index}
|
|
152
158
|
href={item.url}
|
|
153
|
-
selected={item.url === siteMetadata.header.url + path}
|
|
159
|
+
selected={item.url === siteMetadata.header.url + pathPrefix + path}
|
|
154
160
|
sx={{fontSize: 2, lineHeight: 'condensed'}}
|
|
155
161
|
>
|
|
156
162
|
{item.title}
|