@primer/gatsby-theme-doctocat 4.6.0 → 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 +13 -0
- package/package.json +1 -1
- package/src/components/header.js +14 -3
- package/src/components/nav-drawer.js +4 -3
- package/src/primer-nav.yml +1 -1
- package/src/use-path-prefix.js +14 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
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
|
+
|
|
9
|
+
## 4.6.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`e2cd01a`](https://github.com/primer/doctocat/commit/e2cd01a79e668c21a762e82a5f1b914be0d0c5b6) [#613](https://github.com/primer/doctocat/pull/613) Thanks [@josepmartins](https://github.com/josepmartins)! - - Fix the primer navigation about link
|
|
14
|
+
- Removes mono space font in the nav drawer + fontweight bold to match top left navigation
|
|
15
|
+
|
|
3
16
|
## 4.6.0
|
|
4
17
|
|
|
5
18
|
### Minor 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>
|
|
@@ -147,7 +153,12 @@ function PrimerNavItems({siteMetadata, items, path}) {
|
|
|
147
153
|
<UnderlineNav aria-label="main navigation" sx={{border: 'none'}}>
|
|
148
154
|
{items.map((item, index) => {
|
|
149
155
|
return (
|
|
150
|
-
<UnderlineNav.Link
|
|
156
|
+
<UnderlineNav.Link
|
|
157
|
+
key={index}
|
|
158
|
+
href={item.url}
|
|
159
|
+
selected={item.url === siteMetadata.header.url + pathPrefix + path}
|
|
160
|
+
sx={{fontSize: 2, lineHeight: 'condensed'}}
|
|
161
|
+
>
|
|
151
162
|
{item.title}
|
|
152
163
|
</UnderlineNav.Link>
|
|
153
164
|
)
|
|
@@ -60,7 +60,7 @@ function NavDrawer({isOpen, onDismiss}) {
|
|
|
60
60
|
}}
|
|
61
61
|
>
|
|
62
62
|
<Box sx={{py: 3, pl: 4, pr: 3, alignItems: 'center', justifyContent: 'space-between', display: 'flex'}}>
|
|
63
|
-
<Link href="https://primer.style" sx={{
|
|
63
|
+
<Link href="https://primer.style" sx={{fontWeight: 'bold', color: 'inherit'}}>
|
|
64
64
|
Primer
|
|
65
65
|
</Link>
|
|
66
66
|
<Button aria-label="Close" onClick={onDismiss}>
|
|
@@ -86,7 +86,7 @@ function NavDrawer({isOpen, onDismiss}) {
|
|
|
86
86
|
<Link
|
|
87
87
|
as={GatsbyLink}
|
|
88
88
|
to="/"
|
|
89
|
-
sx={{display: 'inline-block', color: 'inherit',
|
|
89
|
+
sx={{display: 'inline-block', color: 'inherit', fontWeight: 'bold', mx: 4, mt: 4}}
|
|
90
90
|
>
|
|
91
91
|
{siteMetadata.title}
|
|
92
92
|
</Link>
|
|
@@ -111,7 +111,8 @@ function PrimerNavItems({items}) {
|
|
|
111
111
|
borderRadius: 0,
|
|
112
112
|
borderTopWidth: index !== 0 ? 1 : 0,
|
|
113
113
|
borderColor: 'border.muted',
|
|
114
|
-
|
|
114
|
+
px: 4,
|
|
115
|
+
py: 3,
|
|
115
116
|
borderStyle: 'solid'
|
|
116
117
|
}}
|
|
117
118
|
>
|
package/src/primer-nav.yml
CHANGED