@primer/gatsby-theme-doctocat 4.4.0 → 4.4.1
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 +12 -0
- package/package.json +1 -1
- package/src/components/container.js +1 -5
- package/src/components/header.js +46 -33
- package/src/components/heading.js +27 -15
- package/src/components/hero-layout.js +1 -1
- package/src/components/layout.js +3 -2
- 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/primer-nav.yml +8 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @primer/gatsby-theme-doctocat
|
|
2
2
|
|
|
3
|
+
## 4.4.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`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
|
|
8
|
+
|
|
9
|
+
* [`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.
|
|
10
|
+
|
|
11
|
+
- [`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.
|
|
12
|
+
|
|
13
|
+
* [`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
|
|
14
|
+
|
|
3
15
|
## 4.4.0
|
|
4
16
|
|
|
5
17
|
### 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
|
@@ -20,6 +20,8 @@ function Header({isSearchEnabled}) {
|
|
|
20
20
|
<ThemeProvider colorMode="night" nightScheme="dark_dimmed">
|
|
21
21
|
<Box sx={{position: 'sticky', top: 0, zIndex: 1}}>
|
|
22
22
|
<Box
|
|
23
|
+
as="header"
|
|
24
|
+
aria-labelledby="site-heading"
|
|
23
25
|
sx={{
|
|
24
26
|
display: 'flex',
|
|
25
27
|
height: HEADER_HEIGHT,
|
|
@@ -40,45 +42,56 @@ function Header({isSearchEnabled}) {
|
|
|
40
42
|
>
|
|
41
43
|
<StyledOcticon icon={MarkGithubIcon} size="medium" />
|
|
42
44
|
</Link>
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
display: [
|
|
50
|
-
// We only hide "Primer" on small viewports if a shortName is defined.
|
|
51
|
-
siteMetadata.shortName ? 'none' : 'inline-block',
|
|
52
|
-
null,
|
|
53
|
-
null,
|
|
54
|
-
'inline-block'
|
|
55
|
-
]
|
|
56
|
-
}}
|
|
57
|
-
>
|
|
58
|
-
{siteMetadata.header.title}
|
|
59
|
-
</Link>
|
|
60
|
-
) : null}
|
|
61
|
-
{siteMetadata.shortName ? (
|
|
62
|
-
<>
|
|
63
|
-
{siteMetadata.header.title && (
|
|
64
|
-
<Text
|
|
65
|
-
sx={{display: ['none', null, null, 'inline-block'], color: 'accent.fg', fontFamily: 'mono', mx: 2}}
|
|
66
|
-
>
|
|
67
|
-
/
|
|
68
|
-
</Text>
|
|
69
|
-
)}
|
|
45
|
+
<Box
|
|
46
|
+
as="h2"
|
|
47
|
+
id="site-heading"
|
|
48
|
+
sx={{fontSize: 'unset', fontWeight: 'unset', m: 0, display: 'flex', alignItems: 'center'}}
|
|
49
|
+
>
|
|
50
|
+
{siteMetadata.header.title ? (
|
|
70
51
|
<Link
|
|
71
|
-
|
|
72
|
-
to="/"
|
|
52
|
+
href={siteMetadata.header.url}
|
|
73
53
|
sx={{
|
|
74
54
|
color: 'accent.fg',
|
|
75
|
-
fontFamily: 'mono'
|
|
55
|
+
fontFamily: 'mono',
|
|
56
|
+
display: [
|
|
57
|
+
// We only hide "Primer" on small viewports if a shortName is defined.
|
|
58
|
+
siteMetadata.shortName ? 'none' : 'inline-block',
|
|
59
|
+
null,
|
|
60
|
+
null,
|
|
61
|
+
'inline-block'
|
|
62
|
+
]
|
|
76
63
|
}}
|
|
77
64
|
>
|
|
78
|
-
{siteMetadata.
|
|
65
|
+
{siteMetadata.header.title}
|
|
79
66
|
</Link>
|
|
80
|
-
|
|
81
|
-
|
|
67
|
+
) : null}
|
|
68
|
+
{siteMetadata.shortName ? (
|
|
69
|
+
<>
|
|
70
|
+
{siteMetadata.header.title && (
|
|
71
|
+
<Text
|
|
72
|
+
sx={{
|
|
73
|
+
display: ['none', null, null, 'inline-block'],
|
|
74
|
+
color: 'accent.fg',
|
|
75
|
+
fontFamily: 'mono',
|
|
76
|
+
mx: 2
|
|
77
|
+
}}
|
|
78
|
+
>
|
|
79
|
+
/
|
|
80
|
+
</Text>
|
|
81
|
+
)}
|
|
82
|
+
<Link
|
|
83
|
+
as={GatsbyLink}
|
|
84
|
+
to="/"
|
|
85
|
+
sx={{
|
|
86
|
+
color: 'accent.fg',
|
|
87
|
+
fontFamily: 'mono'
|
|
88
|
+
}}
|
|
89
|
+
>
|
|
90
|
+
{siteMetadata.shortName}
|
|
91
|
+
</Link>
|
|
92
|
+
</>
|
|
93
|
+
) : null}
|
|
94
|
+
</Box>
|
|
82
95
|
|
|
83
96
|
{isSearchEnabled ? (
|
|
84
97
|
<Box sx={{display: ['none', null, null, 'block'], ml: 4}}>
|
|
@@ -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,6 +52,7 @@ function Layout({children, pageContext}) {
|
|
|
52
52
|
<Sidebar />
|
|
53
53
|
</Box>
|
|
54
54
|
<Box
|
|
55
|
+
as="main"
|
|
55
56
|
id="skip-nav"
|
|
56
57
|
sx={{
|
|
57
58
|
justifyContent: 'center',
|
|
@@ -74,9 +75,9 @@ function Layout({children, pageContext}) {
|
|
|
74
75
|
}}
|
|
75
76
|
css={{gridArea: 'table-of-contents', overflow: 'auto'}}
|
|
76
77
|
>
|
|
77
|
-
<
|
|
78
|
+
<Heading as="h3" sx={{fontSize: 2, display: 'inline-block', fontWeight: 'bold', pl: 3}} id="toc-heading">
|
|
78
79
|
On this page
|
|
79
|
-
</
|
|
80
|
+
</Heading>
|
|
80
81
|
<TableOfContents aria-labelledby="toc-heading" items={pageContext.tableOfContents.items} />
|
|
81
82
|
</Box>
|
|
82
83
|
) : null}
|
|
@@ -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
|
+
<VisuallyHidden>
|
|
35
|
+
<h3 id="nav-heading">Site navigation</h3>
|
|
36
|
+
</VisuallyHidden>
|
|
37
|
+
<NavList aria-labelledby="nav-heading">
|
|
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
|
+
<h3 id="footer-heading">Page footer</h3>
|
|
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
|
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
|