@primer/gatsby-theme-doctocat 4.4.0 → 4.4.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 +18 -0
- package/package.json +1 -1
- package/src/components/container.js +1 -5
- package/src/components/header.js +9 -1
- package/src/components/heading.js +27 -15
- package/src/components/hero-layout.js +1 -1
- package/src/components/layout.js +3 -4
- package/src/components/mobile-search.js +2 -1
- package/src/components/nav-items.js +43 -37
- package/src/components/page-footer.js +7 -1
- package/src/components/search.js +3 -1
- package/src/components/text-input.js +7 -1
- package/src/components/visually-hidden.js +16 -0
- package/src/components/wrap-page-element.js +0 -2
- package/src/primer-nav.yml +8 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @primer/gatsby-theme-doctocat
|
|
2
2
|
|
|
3
|
+
## 4.4.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`84f8a7e`](https://github.com/primer/doctocat/commit/84f8a7e6b64b431a620b59e5dcb54366ccc3f5c6) [#565](https://github.com/primer/doctocat/pull/565) Thanks [@kendallgassner](https://github.com/kendallgassner)! - Accessibility improvements
|
|
8
|
+
|
|
9
|
+
## 4.4.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`2dbdb69`](https://github.com/primer/doctocat/commit/2dbdb69562a13e600a994063fd2736cacde68d45) [#560](https://github.com/primer/doctocat/pull/560) Thanks [@colebemis](https://github.com/colebemis)! - Move heading permalinks to after headings
|
|
14
|
+
|
|
15
|
+
* [`d3ddb0a`](https://github.com/primer/doctocat/commit/d3ddb0afac5ce764b8fab261e1f90ed0235b7798) [#548](https://github.com/primer/doctocat/pull/548) Thanks [@maximedegreve](https://github.com/maximedegreve)! - Remove `Command line` from the `Design` menu since it's now merged in guidelines.
|
|
16
|
+
|
|
17
|
+
- [`2883499`](https://github.com/primer/doctocat/commit/2883499f9309af8a6388f053541d45ad3b94d570) [#550](https://github.com/primer/doctocat/pull/550) Thanks [@maximedegreve](https://github.com/maximedegreve)! - Remove `Mobile` from the `Design` menu since it's now merged in our guidelines.
|
|
18
|
+
|
|
19
|
+
* [`a8fd12e`](https://github.com/primer/doctocat/commit/a8fd12ec0bcfeb35604936ef89707f279ed7ee52) [#561](https://github.com/primer/doctocat/pull/561) Thanks [@colebemis](https://github.com/colebemis)! - Miscellaneous accessibility improvements
|
|
20
|
+
|
|
3
21
|
## 4.4.0
|
|
4
22
|
|
|
5
23
|
### Minor Changes
|
package/package.json
CHANGED
|
@@ -2,11 +2,7 @@ import {Box} from '@primer/react'
|
|
|
2
2
|
import React from 'react'
|
|
3
3
|
|
|
4
4
|
function Container({children}) {
|
|
5
|
-
return
|
|
6
|
-
<Box id="skip-nav" sx={{width: '100%', maxWidth: 960, p: 5, mx: 'auto'}}>
|
|
7
|
-
{children}
|
|
8
|
-
</Box>
|
|
9
|
-
)
|
|
5
|
+
return <Box sx={{width: '100%', maxWidth: 960, p: 5, mx: 'auto'}}>{children}</Box>
|
|
10
6
|
}
|
|
11
7
|
|
|
12
8
|
export default Container
|
package/src/components/header.js
CHANGED
|
@@ -8,6 +8,7 @@ import MobileSearch from './mobile-search'
|
|
|
8
8
|
import NavDrawer, {useNavDrawerState} from './nav-drawer'
|
|
9
9
|
import NavDropdown, {NavDropdownItem} from './nav-dropdown'
|
|
10
10
|
import Search from './search'
|
|
11
|
+
import SkipLink from './skip-link'
|
|
11
12
|
|
|
12
13
|
export const HEADER_HEIGHT = 66
|
|
13
14
|
|
|
@@ -20,6 +21,7 @@ function Header({isSearchEnabled}) {
|
|
|
20
21
|
<ThemeProvider colorMode="night" nightScheme="dark_dimmed">
|
|
21
22
|
<Box sx={{position: 'sticky', top: 0, zIndex: 1}}>
|
|
22
23
|
<Box
|
|
24
|
+
as="header"
|
|
23
25
|
sx={{
|
|
24
26
|
display: 'flex',
|
|
25
27
|
height: HEADER_HEIGHT,
|
|
@@ -29,6 +31,7 @@ function Header({isSearchEnabled}) {
|
|
|
29
31
|
bg: 'canvas.default'
|
|
30
32
|
}}
|
|
31
33
|
>
|
|
34
|
+
<SkipLink />
|
|
32
35
|
<Box sx={{display: 'flex', alignItems: 'center'}}>
|
|
33
36
|
<Link
|
|
34
37
|
href={siteMetadata.header.logoUrl}
|
|
@@ -62,7 +65,12 @@ function Header({isSearchEnabled}) {
|
|
|
62
65
|
<>
|
|
63
66
|
{siteMetadata.header.title && (
|
|
64
67
|
<Text
|
|
65
|
-
sx={{
|
|
68
|
+
sx={{
|
|
69
|
+
display: ['none', null, null, 'inline-block'],
|
|
70
|
+
color: 'accent.fg',
|
|
71
|
+
fontFamily: 'mono',
|
|
72
|
+
mx: 2
|
|
73
|
+
}}
|
|
66
74
|
>
|
|
67
75
|
/
|
|
68
76
|
</Text>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {Heading, Link} from '@primer/react'
|
|
1
|
+
import {Heading, Link, StyledOcticon} from '@primer/react'
|
|
2
2
|
import {LinkIcon} from '@primer/octicons-react'
|
|
3
3
|
import themeGet from '@styled-system/theme-get'
|
|
4
4
|
import GithubSlugger from 'github-slugger'
|
|
@@ -11,14 +11,17 @@ const StyledHeading = styled(Heading)`
|
|
|
11
11
|
margin-top: ${themeGet('space.4')};
|
|
12
12
|
margin-bottom: ${themeGet('space.3')};
|
|
13
13
|
scroll-margin-top: ${HEADER_HEIGHT + 24}px;
|
|
14
|
+
line-height: ${themeGet('lineHeights.condensed')};
|
|
14
15
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
@media (hover: hover) {
|
|
17
|
+
& .octicon-link {
|
|
18
|
+
visibility: hidden;
|
|
19
|
+
}
|
|
18
20
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
&:hover .octicon-link,
|
|
22
|
+
&:focus-within .octicon-link {
|
|
23
|
+
visibility: visible;
|
|
24
|
+
}
|
|
22
25
|
}
|
|
23
26
|
`
|
|
24
27
|
|
|
@@ -31,28 +34,37 @@ function MarkdownHeading({children, ...props}) {
|
|
|
31
34
|
<StyledHeading id={id} {...props}>
|
|
32
35
|
<Link
|
|
33
36
|
href={`#${id}`}
|
|
34
|
-
aria-label={`${text} permalink`}
|
|
35
37
|
sx={{
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
38
|
+
color: 'inherit',
|
|
39
|
+
'&:hover, &:focus': {
|
|
40
|
+
textDecoration: 'none'
|
|
41
|
+
}
|
|
39
42
|
}}
|
|
40
43
|
>
|
|
41
|
-
|
|
44
|
+
{children}
|
|
45
|
+
<StyledOcticon
|
|
46
|
+
icon={LinkIcon}
|
|
47
|
+
className="octicon-link"
|
|
48
|
+
sx={{
|
|
49
|
+
ml: 2,
|
|
50
|
+
color: 'fg.muted',
|
|
51
|
+
// !important is needed here to override default icon styles
|
|
52
|
+
verticalAlign: 'middle !important'
|
|
53
|
+
}}
|
|
54
|
+
/>
|
|
42
55
|
</Link>
|
|
43
|
-
{children}
|
|
44
56
|
</StyledHeading>
|
|
45
57
|
)
|
|
46
58
|
}
|
|
47
59
|
|
|
48
60
|
const StyledH1 = styled(StyledHeading).attrs({as: 'h1'})`
|
|
49
|
-
padding-bottom: ${themeGet('space.
|
|
61
|
+
padding-bottom: ${themeGet('space.2')};
|
|
50
62
|
font-size: ${themeGet('fontSizes.5')};
|
|
51
63
|
border-bottom: 1px solid ${themeGet('colors.border.default')};
|
|
52
64
|
`
|
|
53
65
|
|
|
54
66
|
const StyledH2 = styled(StyledHeading).attrs({as: 'h2'})`
|
|
55
|
-
padding-bottom: ${themeGet('space.
|
|
67
|
+
padding-bottom: ${themeGet('space.2')};
|
|
56
68
|
font-size: ${themeGet('fontSizes.4')};
|
|
57
69
|
border-bottom: 1px solid ${themeGet('colors.border.default')};
|
|
58
70
|
`
|
package/src/components/layout.js
CHANGED
|
@@ -52,7 +52,6 @@ function Layout({children, pageContext}) {
|
|
|
52
52
|
<Sidebar />
|
|
53
53
|
</Box>
|
|
54
54
|
<Box
|
|
55
|
-
id="skip-nav"
|
|
56
55
|
sx={{
|
|
57
56
|
justifyContent: 'center',
|
|
58
57
|
flexDirection: 'row-reverse',
|
|
@@ -74,14 +73,14 @@ function Layout({children, pageContext}) {
|
|
|
74
73
|
}}
|
|
75
74
|
css={{gridArea: 'table-of-contents', overflow: 'auto'}}
|
|
76
75
|
>
|
|
77
|
-
<
|
|
76
|
+
<Heading as="h3" sx={{fontSize: 2, display: 'inline-block', fontWeight: 'bold', pl: 3}} id="toc-heading">
|
|
78
77
|
On this page
|
|
79
|
-
</
|
|
78
|
+
</Heading>
|
|
80
79
|
<TableOfContents aria-labelledby="toc-heading" items={pageContext.tableOfContents.items} />
|
|
81
80
|
</Box>
|
|
82
81
|
) : null}
|
|
83
82
|
<Box sx={{width: '100%', maxWidth: '960px'}}>
|
|
84
|
-
<Box sx={{mb: 4}}>
|
|
83
|
+
<Box as="main" id="skip-nav" sx={{mb: 4}}>
|
|
85
84
|
<Box sx={{alignItems: 'center', display: 'flex'}}>
|
|
86
85
|
<Heading as="h1">{title}</Heading>{' '}
|
|
87
86
|
</Box>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {Box, Button} from '@primer/react'
|
|
2
|
-
import {XIcon} from '@primer/octicons-react'
|
|
2
|
+
import {SearchIcon, XIcon} from '@primer/octicons-react'
|
|
3
3
|
import Downshift from 'downshift'
|
|
4
4
|
import {AnimatePresence, motion} from 'framer-motion'
|
|
5
5
|
import {navigate} from 'gatsby'
|
|
@@ -85,6 +85,7 @@ function MobileSearch({isOpen, onDismiss}) {
|
|
|
85
85
|
style={{width: '100%', originX: '100%'}}
|
|
86
86
|
>
|
|
87
87
|
<TextInput
|
|
88
|
+
leadingVisual={SearchIcon}
|
|
88
89
|
{...getInputProps({
|
|
89
90
|
placeholder: `Search`,
|
|
90
91
|
sx: {width: '100%'}
|
|
@@ -4,6 +4,7 @@ import {useLocation} from '@reach/router'
|
|
|
4
4
|
import {Link as GatsbyLink, withPrefix} from 'gatsby'
|
|
5
5
|
import preval from 'preval.macro'
|
|
6
6
|
import React from 'react'
|
|
7
|
+
import VisuallyHidden from './visually-hidden'
|
|
7
8
|
|
|
8
9
|
// This code needs to run at build-time so it can access the file system.
|
|
9
10
|
const repositoryUrl = preval`
|
|
@@ -29,43 +30,48 @@ function NavItem({href, children}) {
|
|
|
29
30
|
|
|
30
31
|
function NavItems({items}) {
|
|
31
32
|
return (
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
<
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
33
|
+
<>
|
|
34
|
+
<NavList aria-label="Site">
|
|
35
|
+
<VisuallyHidden>
|
|
36
|
+
<h3>Site navigation</h3>
|
|
37
|
+
</VisuallyHidden>
|
|
38
|
+
{items.map(item => (
|
|
39
|
+
<React.Fragment key={item.title}>
|
|
40
|
+
{item.children ? (
|
|
41
|
+
<NavList.Group title={item.title}>
|
|
42
|
+
{item.children.map(child => (
|
|
43
|
+
<NavItem key={child.title} href={child.url}>
|
|
44
|
+
{child.title}
|
|
45
|
+
{child.children ? (
|
|
46
|
+
<NavList.SubNav>
|
|
47
|
+
{child.children.map(subChild => (
|
|
48
|
+
<NavItem key={subChild.title} href={subChild.url}>
|
|
49
|
+
{subChild.title}
|
|
50
|
+
</NavItem>
|
|
51
|
+
))}
|
|
52
|
+
</NavList.SubNav>
|
|
53
|
+
) : null}
|
|
54
|
+
</NavItem>
|
|
55
|
+
))}
|
|
56
|
+
</NavList.Group>
|
|
57
|
+
) : (
|
|
58
|
+
<NavItem href={item.url}>{item.title}</NavItem>
|
|
59
|
+
)}
|
|
60
|
+
</React.Fragment>
|
|
61
|
+
))}
|
|
62
|
+
{repositoryUrl ? (
|
|
63
|
+
<>
|
|
64
|
+
<NavList.Divider />
|
|
65
|
+
<NavList.Item href={repositoryUrl}>
|
|
66
|
+
GitHub
|
|
67
|
+
<NavList.TrailingVisual>
|
|
68
|
+
<LinkExternalIcon />
|
|
69
|
+
</NavList.TrailingVisual>
|
|
70
|
+
</NavList.Item>
|
|
71
|
+
</>
|
|
72
|
+
) : null}
|
|
73
|
+
</NavList>
|
|
74
|
+
</>
|
|
69
75
|
)
|
|
70
76
|
}
|
|
71
77
|
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import {Box, Link, StyledOcticon} from '@primer/react'
|
|
2
1
|
import {PencilIcon} from '@primer/octicons-react'
|
|
2
|
+
import {Box, Link, StyledOcticon} from '@primer/react'
|
|
3
3
|
import React from 'react'
|
|
4
4
|
import Contributors from './contributors'
|
|
5
|
+
import VisuallyHidden from './visually-hidden'
|
|
5
6
|
|
|
6
7
|
function PageFooter({editUrl, contributors}) {
|
|
7
8
|
return editUrl || contributors.length > 0 ? (
|
|
8
9
|
<Box
|
|
10
|
+
as="footer"
|
|
11
|
+
aria-labelledby="footer-heading"
|
|
9
12
|
sx={{
|
|
10
13
|
borderWidth: 0,
|
|
11
14
|
borderTopWidth: 1,
|
|
@@ -16,6 +19,9 @@ function PageFooter({editUrl, contributors}) {
|
|
|
16
19
|
borderColor: 'border.default'
|
|
17
20
|
}}
|
|
18
21
|
>
|
|
22
|
+
<VisuallyHidden>
|
|
23
|
+
<h2 id="footer-heading">Footer</h2>
|
|
24
|
+
</VisuallyHidden>
|
|
19
25
|
<Box sx={{gridGap: 4, display: 'grid'}}>
|
|
20
26
|
{editUrl ? (
|
|
21
27
|
<Link href={editUrl}>
|
package/src/components/search.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import {SearchIcon} from '@primer/octicons-react'
|
|
1
2
|
import {Box, ThemeProvider} from '@primer/react'
|
|
2
3
|
import Downshift from 'downshift'
|
|
3
4
|
import {navigate} from 'gatsby'
|
|
@@ -46,10 +47,11 @@ function Search() {
|
|
|
46
47
|
{({getInputProps, getItemProps, getMenuProps, getRootProps, isOpen, highlightedIndex}) => (
|
|
47
48
|
<Box {...getRootProps({position: 'relative'})}>
|
|
48
49
|
<TextInput
|
|
50
|
+
leadingVisual={SearchIcon}
|
|
49
51
|
{...getInputProps({
|
|
50
52
|
placeholder: `Search ${siteMetadata.title}`,
|
|
51
53
|
sx: {
|
|
52
|
-
width:
|
|
54
|
+
width: 300
|
|
53
55
|
}
|
|
54
56
|
})}
|
|
55
57
|
/>
|
|
@@ -6,6 +6,12 @@ const TextInput = styled(PrimerTextInput)`
|
|
|
6
6
|
* Otherwise, iOS browsers will zoom in when the input is focused.
|
|
7
7
|
* TODO: Update font-size of TextInput in @primer/react.
|
|
8
8
|
*/
|
|
9
|
-
|
|
9
|
+
input {
|
|
10
|
+
font-size: ${themeGet('fontSizes.2')} !important;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
input::placeholder {
|
|
14
|
+
color: ${themeGet('colors.fg.muted')} !important;
|
|
15
|
+
}
|
|
10
16
|
`
|
|
11
17
|
export default TextInput
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import styled from 'styled-components'
|
|
2
|
+
|
|
3
|
+
/** Visually hide an element, but keep it accessible to screen readers. */
|
|
4
|
+
const VisuallyHidden = styled.div`
|
|
5
|
+
position: absolute;
|
|
6
|
+
width: 1px;
|
|
7
|
+
height: 1px;
|
|
8
|
+
padding: 0;
|
|
9
|
+
margin: -1px;
|
|
10
|
+
overflow: hidden;
|
|
11
|
+
clip: rect(0, 0, 0, 0);
|
|
12
|
+
white-space: nowrap;
|
|
13
|
+
border-width: 0;
|
|
14
|
+
`
|
|
15
|
+
|
|
16
|
+
export default VisuallyHidden
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import {BaseStyles, themeGet} from '@primer/react'
|
|
2
2
|
import React from 'react'
|
|
3
3
|
import {createGlobalStyle} from 'styled-components'
|
|
4
|
-
import SkipLink from './skip-link'
|
|
5
4
|
|
|
6
5
|
const GlobalStyles = createGlobalStyle`
|
|
7
6
|
body {
|
|
@@ -29,7 +28,6 @@ function wrapPageElement({element}) {
|
|
|
29
28
|
return (
|
|
30
29
|
<BaseStyles>
|
|
31
30
|
<GlobalStyles />
|
|
32
|
-
<SkipLink />
|
|
33
31
|
{element}
|
|
34
32
|
</BaseStyles>
|
|
35
33
|
)
|
package/src/primer-nav.yml
CHANGED
|
@@ -3,15 +3,13 @@
|
|
|
3
3
|
- title: Interface guidelines
|
|
4
4
|
url: https://primer.style/design
|
|
5
5
|
- title: Octicons
|
|
6
|
-
url: https://primer.style/
|
|
7
|
-
- title: Presentations
|
|
8
|
-
url: https://primer.style/presentations
|
|
9
|
-
- title: Command line
|
|
10
|
-
url: https://primer.style/cli
|
|
11
|
-
- title: Mobile
|
|
12
|
-
url: https://primer.style/mobile
|
|
6
|
+
url: https://primer.style/design/foundations/icons
|
|
13
7
|
- title: Desktop
|
|
14
|
-
url: https://primer.style/desktop
|
|
8
|
+
url: https://primer.style/design/native/desktop
|
|
9
|
+
- title: Mobile
|
|
10
|
+
url: https://primer.style/design/native/mobile
|
|
11
|
+
- title: CLI
|
|
12
|
+
url: https://primer.style/design/native/cli
|
|
15
13
|
- title: Build
|
|
16
14
|
children:
|
|
17
15
|
- title: CSS
|
|
@@ -23,6 +21,6 @@
|
|
|
23
21
|
- title: ViewComponents
|
|
24
22
|
url: https://primer.style/view-components
|
|
25
23
|
- title: Contribute
|
|
26
|
-
url: https://primer.style/contribute
|
|
24
|
+
url: https://primer.style/design/guides/contribute
|
|
27
25
|
- title: About
|
|
28
|
-
url: https://primer.style/
|
|
26
|
+
url: https://primer.style/design/guides/about
|