@primer/gatsby-theme-doctocat 3.2.0 → 4.0.0
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/.eslintrc.json +2 -1
- package/CHANGELOG.md +40 -1
- package/babel.config.js +11 -1
- package/gatsby-node.js +2 -2
- package/jest.config.js +2 -1
- package/package.json +11 -11
- package/setup-tests.js +9 -0
- package/src/components/caption.js +2 -2
- package/src/components/clipboard-copy.js +1 -1
- package/src/components/code.js +11 -14
- package/src/components/container.js +2 -2
- package/src/components/contributors.js +4 -4
- package/src/components/details.js +1 -1
- package/src/components/do-dont.js +37 -14
- package/src/components/drawer.js +6 -6
- package/src/components/header.js +20 -16
- package/src/components/heading.js +1 -1
- package/src/components/hero-layout.js +8 -8
- package/src/components/hero.js +3 -3
- package/src/components/image-container.js +13 -4
- package/src/components/layout.js +41 -34
- package/src/components/link.js +10 -0
- package/src/components/live-code.js +15 -11
- package/src/components/live-preview-wrapper.js +2 -2
- package/src/components/mobile-search.js +19 -10
- package/src/components/nav-drawer.js +50 -23
- package/src/components/nav-dropdown.js +11 -9
- package/src/components/nav-items.js +37 -59
- package/src/components/page-footer.js +15 -5
- package/src/components/search-results.js +6 -11
- package/src/components/search.js +11 -9
- package/src/components/sidebar.js +17 -10
- package/src/components/skip-link.js +1 -1
- package/src/components/source-link.js +2 -4
- package/src/components/status-label.js +1 -1
- package/src/components/storybook-link.js +2 -4
- package/src/components/table-of-contents.js +8 -20
- package/src/components/table.js +1 -0
- package/src/components/text-input.js +2 -2
- package/src/components/wrap-page-element.js +1 -1
- package/src/components/wrap-root-element.js +2 -1
- package/src/search.worker.js +1 -1
package/src/components/search.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {Box, ThemeProvider} from '@primer/react'
|
|
2
2
|
import Downshift from 'downshift'
|
|
3
3
|
import {navigate} from 'gatsby'
|
|
4
4
|
import React from 'react'
|
|
5
5
|
import useSearch from '../use-search'
|
|
6
6
|
import useSiteMetadata from '../use-site-metadata'
|
|
7
|
-
import TextInput from './text-input'
|
|
8
7
|
import SearchResults from './search-results'
|
|
8
|
+
import TextInput from './text-input'
|
|
9
9
|
|
|
10
10
|
function stateReducer(state, changes) {
|
|
11
11
|
switch (changes.type) {
|
|
@@ -44,7 +44,7 @@ function Search() {
|
|
|
44
44
|
stateReducer={stateReducer}
|
|
45
45
|
>
|
|
46
46
|
{({getInputProps, getItemProps, getMenuProps, getRootProps, isOpen, highlightedIndex}) => (
|
|
47
|
-
<
|
|
47
|
+
<Box {...getRootProps({position: 'relative'})}>
|
|
48
48
|
<TextInput
|
|
49
49
|
{...getInputProps({
|
|
50
50
|
placeholder: `Search ${siteMetadata.title}`,
|
|
@@ -54,7 +54,7 @@ function Search() {
|
|
|
54
54
|
})}
|
|
55
55
|
/>
|
|
56
56
|
{isOpen ? (
|
|
57
|
-
<
|
|
57
|
+
<Box
|
|
58
58
|
{...getMenuProps({
|
|
59
59
|
position: 'absolute',
|
|
60
60
|
left: 0,
|
|
@@ -63,7 +63,7 @@ function Search() {
|
|
|
63
63
|
})}
|
|
64
64
|
>
|
|
65
65
|
<ThemeProvider colorMode="day">
|
|
66
|
-
<
|
|
66
|
+
<Box
|
|
67
67
|
style={{overflow: 'auto'}}
|
|
68
68
|
sx={{
|
|
69
69
|
minWidth: 300,
|
|
@@ -72,15 +72,17 @@ function Search() {
|
|
|
72
72
|
boxShadow: 'shadow.large',
|
|
73
73
|
borderColor: 'border.muted',
|
|
74
74
|
bg: 'canvas.overlay',
|
|
75
|
-
borderRadius: '12px'
|
|
75
|
+
borderRadius: '12px',
|
|
76
|
+
borderWidth: '1px',
|
|
77
|
+
borderStyle: 'solid'
|
|
76
78
|
}}
|
|
77
79
|
>
|
|
78
80
|
<SearchResults results={results} getItemProps={getItemProps} highlightedIndex={highlightedIndex} />
|
|
79
|
-
</
|
|
81
|
+
</Box>
|
|
80
82
|
</ThemeProvider>
|
|
81
|
-
</
|
|
83
|
+
</Box>
|
|
82
84
|
) : null}
|
|
83
|
-
</
|
|
85
|
+
</Box>
|
|
84
86
|
)}
|
|
85
87
|
</Downshift>
|
|
86
88
|
)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {Box} from '@primer/react'
|
|
2
2
|
import React from 'react'
|
|
3
3
|
import navItems from '../nav.yml'
|
|
4
4
|
import {HEADER_HEIGHT} from './header'
|
|
@@ -32,25 +32,32 @@ function Sidebar() {
|
|
|
32
32
|
const scrollContainerProps = usePersistentScroll('sidebar')
|
|
33
33
|
|
|
34
34
|
return (
|
|
35
|
-
<
|
|
35
|
+
<Box
|
|
36
36
|
sx={{
|
|
37
37
|
position: 'sticky',
|
|
38
38
|
top: HEADER_HEIGHT,
|
|
39
39
|
height: `calc(100vh - ${HEADER_HEIGHT}px)`,
|
|
40
|
-
minWidth: 260
|
|
41
|
-
bg: 'canvas.subtle'
|
|
40
|
+
minWidth: 260
|
|
42
41
|
}}
|
|
43
42
|
>
|
|
44
|
-
<
|
|
43
|
+
<Box
|
|
45
44
|
{...scrollContainerProps}
|
|
46
45
|
style={{overflow: 'auto'}}
|
|
47
|
-
sx={{
|
|
46
|
+
sx={{
|
|
47
|
+
borderWidth: 0,
|
|
48
|
+
borderRightWidth: 1,
|
|
49
|
+
borderRadius: 0,
|
|
50
|
+
height: '100%',
|
|
51
|
+
borderStyle: 'solid',
|
|
52
|
+
borderColor: 'border.subtle',
|
|
53
|
+
px: 2
|
|
54
|
+
}}
|
|
48
55
|
>
|
|
49
|
-
<
|
|
56
|
+
<Box sx={{flexDirection: 'column', display: 'flex'}}>
|
|
50
57
|
<NavItems items={navItems} />
|
|
51
|
-
</
|
|
52
|
-
</
|
|
53
|
-
</
|
|
58
|
+
</Box>
|
|
59
|
+
</Box>
|
|
60
|
+
</Box>
|
|
54
61
|
)
|
|
55
62
|
}
|
|
56
63
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {Link, Text} from '@primer/
|
|
1
|
+
import {Link, Text} from '@primer/react'
|
|
2
2
|
import {MarkGithubIcon} from '@primer/octicons-react'
|
|
3
3
|
import React from 'react'
|
|
4
4
|
|
|
@@ -6,9 +6,7 @@ function SourceLink({href}) {
|
|
|
6
6
|
return (
|
|
7
7
|
<Link href={href}>
|
|
8
8
|
<MarkGithubIcon />
|
|
9
|
-
<Text
|
|
10
|
-
View source
|
|
11
|
-
</Text>
|
|
9
|
+
<Text sx={{ml: 2, display: 'inline-block'}}>View source</Text>
|
|
12
10
|
</Link>
|
|
13
11
|
)
|
|
14
12
|
}
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import {Link, Text} from '@primer/
|
|
1
|
+
import {Link, Text} from '@primer/react'
|
|
2
2
|
import React from 'react'
|
|
3
3
|
|
|
4
4
|
function SourceLink({href}) {
|
|
5
5
|
return (
|
|
6
6
|
<Link href={href}>
|
|
7
7
|
<StorybookIcon />
|
|
8
|
-
<Text
|
|
9
|
-
View storybook
|
|
10
|
-
</Text>
|
|
8
|
+
<Text sx={{ml: 2, display: 'inline-block'}}>View storybook</Text>
|
|
11
9
|
</Link>
|
|
12
10
|
)
|
|
13
11
|
}
|
|
@@ -1,28 +1,16 @@
|
|
|
1
|
-
import {Box, Link} from '@primer/
|
|
1
|
+
import {Box, Link} from '@primer/react'
|
|
2
2
|
import React from 'react'
|
|
3
|
+
import {NavList} from '@primer/react/drafts'
|
|
3
4
|
|
|
4
|
-
function TableOfContents({items, depth}) {
|
|
5
|
+
function TableOfContents({'aria-labelledby': ariaLabelledBy, items, depth}) {
|
|
5
6
|
return (
|
|
6
|
-
<
|
|
7
|
+
<NavList aria-labelledby={ariaLabelledBy}>
|
|
7
8
|
{items.map(item => (
|
|
8
|
-
<
|
|
9
|
-
{item.title
|
|
10
|
-
|
|
11
|
-
href={item.url}
|
|
12
|
-
sx={{
|
|
13
|
-
display: 'inline-block',
|
|
14
|
-
py: 1,
|
|
15
|
-
fontSize: [2, null, 1],
|
|
16
|
-
color: 'fg.muted'
|
|
17
|
-
}}
|
|
18
|
-
>
|
|
19
|
-
{item.title}
|
|
20
|
-
</Link>
|
|
21
|
-
) : null}
|
|
22
|
-
{item.items ? <TableOfContents items={item.items} depth={depth + 1} /> : null}
|
|
23
|
-
</Box>
|
|
9
|
+
<NavList.Item key={item.title} href={item.url}>
|
|
10
|
+
{item.title}
|
|
11
|
+
</NavList.Item>
|
|
24
12
|
))}
|
|
25
|
-
</
|
|
13
|
+
</NavList>
|
|
26
14
|
)
|
|
27
15
|
}
|
|
28
16
|
|
package/src/components/table.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {TextInput as PrimerTextInput, themeGet} from '@primer/
|
|
1
|
+
import {TextInput as PrimerTextInput, themeGet} from '@primer/react'
|
|
2
2
|
import styled from 'styled-components'
|
|
3
3
|
|
|
4
4
|
const TextInput = styled(PrimerTextInput)`
|
|
5
5
|
/* The font-size of inputs should never be less than 16px.
|
|
6
6
|
* Otherwise, iOS browsers will zoom in when the input is focused.
|
|
7
|
-
* TODO: Update font-size of TextInput in @primer/
|
|
7
|
+
* TODO: Update font-size of TextInput in @primer/react.
|
|
8
8
|
*/
|
|
9
9
|
font-size: ${themeGet('fontSizes.2')} !important;
|
|
10
10
|
`
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {MDXProvider} from '@mdx-js/react'
|
|
2
|
-
import {
|
|
2
|
+
import {ThemeProvider} from '@primer/react'
|
|
3
|
+
import Link from './link'
|
|
3
4
|
import React from 'react'
|
|
4
5
|
import mdxComponents from '../mdx-components'
|
|
5
6
|
import Blockquote from './blockquote'
|
package/src/search.worker.js
CHANGED
|
@@ -3,7 +3,7 @@ import debounce from 'lodash.debounce'
|
|
|
3
3
|
;(function searchWorker() {
|
|
4
4
|
let fuse = null
|
|
5
5
|
|
|
6
|
-
// [MKT]: I landed on the
|
|
6
|
+
// [MKT]: I landed on the debounce wait value of 50 based mostly on
|
|
7
7
|
// experimentation. With both `leading` and `trailing` set to `true`, this
|
|
8
8
|
// feels pretty snappy.
|
|
9
9
|
//
|