@primer/gatsby-theme-doctocat 4.7.1 → 5.1.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/CHANGELOG.md +12 -0
- package/babel.config.js +5 -5
- package/gatsby-config.js +11 -11
- package/gatsby-node.js +8 -8
- package/jest.config.js +2 -1
- package/package.json +41 -32
- package/setup-tests.js +9 -2
- package/src/components/__tests__/contributors.test.js +14 -14
- package/src/components/accessibility-label.js +4 -4
- package/src/components/clipboard-copy.js +3 -3
- package/src/components/code.js +1 -1
- package/src/components/contributors.js +4 -8
- package/src/components/details.js +1 -1
- package/src/components/do-dont.js +3 -3
- package/src/components/frame.js +3 -4
- package/src/components/head.js +6 -0
- package/src/components/header.js +14 -18
- package/src/components/heading.js +9 -9
- package/src/components/image-container.js +1 -1
- package/src/components/layout.js +7 -7
- package/src/components/list.js +3 -0
- package/src/components/live-code.js +3 -3
- package/src/components/mobile-search.js +5 -5
- package/src/components/nav-drawer.js +11 -4
- package/src/components/nav-dropdown.js +2 -2
- package/src/components/note.js +6 -6
- package/src/components/page-footer.js +4 -4
- package/src/components/search-results.js +2 -2
- package/src/components/search.js +4 -4
- package/src/components/sidebar.js +4 -4
- package/src/components/skip-link.js +1 -1
- package/src/components/status-label.js +5 -5
- package/src/components/wrap-root-element.js +4 -4
- package/src/github.js +21 -21
- package/src/search.worker.js +2 -2
- package/src/use-search.js +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @primer/gatsby-theme-doctocat
|
|
2
2
|
|
|
3
|
+
## 5.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`0798937`](https://github.com/primer/doctocat/commit/0798937ceb981c88abc95e428a1d73e3237a6460) [#727](https://github.com/primer/doctocat/pull/727) Thanks [@dipree](https://github.com/dipree)! - Add optional tracking option to head
|
|
8
|
+
|
|
9
|
+
## 5.0.0
|
|
10
|
+
|
|
11
|
+
### Major Changes
|
|
12
|
+
|
|
13
|
+
- [`7b07123`](https://github.com/primer/doctocat/commit/7b0712311247b5f8ddf8e306eb89424d162a6e7b) [#479](https://github.com/primer/doctocat/pull/479) Thanks [@joshblack](https://github.com/joshblack)! - Update gatsby to v3
|
|
14
|
+
|
|
3
15
|
## 4.7.1
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/babel.config.js
CHANGED
package/gatsby-config.js
CHANGED
|
@@ -8,10 +8,10 @@ module.exports = themeOptions => {
|
|
|
8
8
|
header: {
|
|
9
9
|
title: 'Primer',
|
|
10
10
|
url: 'https://primer.style',
|
|
11
|
-
logoUrl: 'https://primer.style'
|
|
11
|
+
logoUrl: 'https://primer.style',
|
|
12
12
|
},
|
|
13
13
|
description: 'A Gatsby theme for creating Primer documentation sites',
|
|
14
|
-
imageUrl: 'https://user-images.githubusercontent.com/10384315/53922681-2f6d3100-402a-11e9-9719-5d1811c8110a.png'
|
|
14
|
+
imageUrl: 'https://user-images.githubusercontent.com/10384315/53922681-2f6d3100-402a-11e9-9719-5d1811c8110a.png',
|
|
15
15
|
},
|
|
16
16
|
plugins: [
|
|
17
17
|
'gatsby-plugin-styled-components',
|
|
@@ -24,23 +24,23 @@ module.exports = themeOptions => {
|
|
|
24
24
|
options: {
|
|
25
25
|
extensions: ['.mdx', '.md'],
|
|
26
26
|
defaultLayouts: {
|
|
27
|
-
default: require.resolve('./src/components/layout.js')
|
|
28
|
-
}
|
|
29
|
-
}
|
|
27
|
+
default: require.resolve('./src/components/layout.js'),
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
30
|
},
|
|
31
31
|
{
|
|
32
32
|
resolve: 'gatsby-source-filesystem',
|
|
33
33
|
options: {
|
|
34
34
|
name: 'content',
|
|
35
|
-
path: path.resolve('./content')
|
|
36
|
-
}
|
|
35
|
+
path: path.resolve('./content'),
|
|
36
|
+
},
|
|
37
37
|
},
|
|
38
38
|
{
|
|
39
39
|
resolve: 'gatsby-plugin-manifest',
|
|
40
40
|
options: {
|
|
41
|
-
icon: themeOptions.icon ? path.resolve(themeOptions.icon) : require.resolve('./src/images/favicon.png')
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
]
|
|
41
|
+
icon: themeOptions.icon ? path.resolve(themeOptions.icon) : require.resolve('./src/images/favicon.png'),
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
45
|
}
|
|
46
46
|
}
|
package/gatsby-node.js
CHANGED
|
@@ -79,10 +79,10 @@ exports.createPages = async ({graphql, actions}, themeOptions) => {
|
|
|
79
79
|
// for us here, and does on the first build,
|
|
80
80
|
// but when HMR kicks in the frontmatter is lost.
|
|
81
81
|
// The solution is to include it here explicitly.
|
|
82
|
-
frontmatter
|
|
83
|
-
}
|
|
82
|
+
frontmatter,
|
|
83
|
+
},
|
|
84
84
|
})
|
|
85
|
-
})
|
|
85
|
+
}),
|
|
86
86
|
)
|
|
87
87
|
}
|
|
88
88
|
|
|
@@ -110,7 +110,7 @@ exports.onPostBuild = async ({graphql}) => {
|
|
|
110
110
|
id: node.context.frontmatter.componentId,
|
|
111
111
|
path: node.path,
|
|
112
112
|
status: node.context.frontmatter.status.toLowerCase(),
|
|
113
|
-
a11yReviewed: node.context.frontmatter.a11yReviewed || false
|
|
113
|
+
a11yReviewed: node.context.frontmatter.a11yReviewed || false,
|
|
114
114
|
}
|
|
115
115
|
})
|
|
116
116
|
|
|
@@ -137,12 +137,12 @@ async function fetchContributors(repo, filePath, accessToken = '') {
|
|
|
137
137
|
const req = {
|
|
138
138
|
method: 'get',
|
|
139
139
|
baseURL: 'https://api.github.com/',
|
|
140
|
-
url: `/repos/${repo.user}/${repo.project}/commits?path=${filePath}&per_page=100
|
|
140
|
+
url: `/repos/${repo.user}/${repo.project}/commits?path=${filePath}&per_page=100`,
|
|
141
141
|
}
|
|
142
142
|
|
|
143
143
|
if (accessToken && accessToken.length) {
|
|
144
144
|
req.headers = {
|
|
145
|
-
Authorization: `token ${accessToken}
|
|
145
|
+
Authorization: `token ${accessToken}`,
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
148
|
|
|
@@ -153,8 +153,8 @@ async function fetchContributors(repo, filePath, accessToken = '') {
|
|
|
153
153
|
login: commit.author && commit.author.login,
|
|
154
154
|
latestCommit: {
|
|
155
155
|
date: commit.commit.author.date,
|
|
156
|
-
url: commit.html_url
|
|
157
|
-
}
|
|
156
|
+
url: commit.html_url,
|
|
157
|
+
},
|
|
158
158
|
}))
|
|
159
159
|
.filter(contributor => Boolean(contributor.login))
|
|
160
160
|
|
package/jest.config.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
+
testEnvironment: 'jsdom',
|
|
2
3
|
collectCoverage: true,
|
|
3
4
|
collectCoverageFrom: ['src/**/*.js'],
|
|
4
5
|
setupFilesAfterEnv: ['<rootDir>/setup-tests.js'],
|
|
5
|
-
transformIgnorePatterns: ['/node_modules/(?!@primer/behaviors)']
|
|
6
|
+
transformIgnorePatterns: ['/node_modules/(?!@primer/behaviors)'],
|
|
6
7
|
}
|
package/package.json
CHANGED
|
@@ -1,81 +1,90 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@primer/gatsby-theme-doctocat",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.1.0",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"test": "jest",
|
|
8
8
|
"lint": "eslint '**/*.{js,ts,tsx}'",
|
|
9
|
-
"lint:fix": "
|
|
9
|
+
"lint:fix": "npm run lint -- --fix"
|
|
10
10
|
},
|
|
11
11
|
"prettier": "@github/prettier-config",
|
|
12
|
+
"resolutions": {
|
|
13
|
+
"graphql": "^15.4.0",
|
|
14
|
+
"graphql-compose": "^7.25.0"
|
|
15
|
+
},
|
|
12
16
|
"devDependencies": {
|
|
13
|
-
"@github/prettier-config": "^0.0.
|
|
17
|
+
"@github/prettier-config": "^0.0.6",
|
|
14
18
|
"eslint": "^8.0.1",
|
|
15
|
-
"eslint-config-prettier": "^
|
|
19
|
+
"eslint-config-prettier": "^9.0.0",
|
|
20
|
+
"eslint-plugin-github": "^4.10.1",
|
|
16
21
|
"eslint-plugin-jsx-a11y": "^6.4.1",
|
|
17
|
-
"eslint-plugin-prettier": "^
|
|
18
|
-
"eslint-plugin-primer-react": "0.
|
|
22
|
+
"eslint-plugin-prettier": "^5.0.1",
|
|
23
|
+
"eslint-plugin-primer-react": "^4.0.3",
|
|
19
24
|
"eslint-plugin-react": "^7.26.1",
|
|
20
|
-
"gatsby": "^
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"react
|
|
25
|
+
"gatsby": "^3.14.6",
|
|
26
|
+
"jest-environment-jsdom": "^29.7.0",
|
|
27
|
+
"prettier": "^3.0.3",
|
|
28
|
+
"react": "^18.2.0",
|
|
29
|
+
"react-dom": "^18.2.0"
|
|
24
30
|
},
|
|
25
31
|
"peerDependencies": {
|
|
26
|
-
"gatsby": "
|
|
27
|
-
"react": "^
|
|
28
|
-
"react-dom": "^
|
|
32
|
+
"gatsby": "3.x",
|
|
33
|
+
"react": "^18.x",
|
|
34
|
+
"react-dom": "^18.x"
|
|
29
35
|
},
|
|
30
36
|
"dependencies": {
|
|
37
|
+
"@babel/core": "^7.19.1",
|
|
31
38
|
"@babel/preset-env": "^7.5.5",
|
|
32
39
|
"@babel/preset-react": "^7.0.0",
|
|
33
40
|
"@mdx-js/mdx": "^1.0.21",
|
|
34
41
|
"@mdx-js/react": "^1.0.21",
|
|
35
42
|
"@primer/component-metadata": "^0.5.1",
|
|
36
43
|
"@primer/octicons-react": "^17.5.0",
|
|
37
|
-
"@primer/react": "^
|
|
44
|
+
"@primer/react": "^36.1.0",
|
|
38
45
|
"@styled-system/theme-get": "^5.0.12",
|
|
39
|
-
"@testing-library/jest-dom": "^
|
|
40
|
-
"@testing-library/react": "^
|
|
41
|
-
"axios": "^
|
|
42
|
-
"babel-jest": "^
|
|
46
|
+
"@testing-library/jest-dom": "^6.1.4",
|
|
47
|
+
"@testing-library/react": "^14.0.0",
|
|
48
|
+
"axios": "^1.5.0",
|
|
49
|
+
"babel-jest": "^29.7.0",
|
|
50
|
+
"babel-plugin-styled-components": "^2.0.7",
|
|
43
51
|
"copy-to-clipboard": "^3.2.0",
|
|
44
52
|
"date-fns": "^2.28.0",
|
|
45
53
|
"details-element-polyfill": "^2.4.0",
|
|
46
54
|
"downshift": "^3.2.10",
|
|
47
55
|
"find-up": "^6.3.0",
|
|
48
56
|
"framer-motion": "^1.4.2",
|
|
49
|
-
"fuse.js": "^
|
|
50
|
-
"gatsby-plugin-catch-links": "^
|
|
51
|
-
"gatsby-plugin-manifest": "^
|
|
57
|
+
"fuse.js": "^7.0.0",
|
|
58
|
+
"gatsby-plugin-catch-links": "^3.14.0",
|
|
59
|
+
"gatsby-plugin-manifest": "^3.14.0",
|
|
52
60
|
"gatsby-plugin-mdx": "^1.0.13",
|
|
53
|
-
"gatsby-plugin-page-creator": "^
|
|
54
|
-
"gatsby-plugin-react-helmet": "^
|
|
55
|
-
"gatsby-plugin-remove-trailing-slashes": "^
|
|
56
|
-
"gatsby-plugin-styled-components": "^
|
|
57
|
-
"gatsby-source-filesystem": "^
|
|
58
|
-
"gatsby-transformer-yaml": "^
|
|
59
|
-
"get-pkg-repo": "^
|
|
61
|
+
"gatsby-plugin-page-creator": "^3.14.0",
|
|
62
|
+
"gatsby-plugin-react-helmet": "^4.14.0",
|
|
63
|
+
"gatsby-plugin-remove-trailing-slashes": "^3.14.0",
|
|
64
|
+
"gatsby-plugin-styled-components": "^4.14.0",
|
|
65
|
+
"gatsby-source-filesystem": "^3.14.0",
|
|
66
|
+
"gatsby-transformer-yaml": "^3.14.0",
|
|
67
|
+
"get-pkg-repo": "^5.0.0",
|
|
60
68
|
"github-slugger": "^1.2.1",
|
|
61
|
-
"html-react-parser": "^
|
|
62
|
-
"jest": "^
|
|
69
|
+
"html-react-parser": "^5.0.3",
|
|
70
|
+
"jest": "^29.7.0",
|
|
63
71
|
"lodash.debounce": "4.0.8",
|
|
64
72
|
"lodash.uniqby": "^4.7.0",
|
|
73
|
+
"path-browserify": "^1.0.1",
|
|
65
74
|
"pkg-up": "^3.1.0",
|
|
66
75
|
"pluralize": "^8.0.0",
|
|
67
76
|
"preval.macro": "^3.0.0",
|
|
68
77
|
"prism-react-renderer": "^1.2.0",
|
|
69
78
|
"prismjs": "^1.27.0",
|
|
70
79
|
"react-addons-text-content": "^0.0.4",
|
|
71
|
-
"react-element-to-jsx-string": "^
|
|
80
|
+
"react-element-to-jsx-string": "^15.0.0",
|
|
72
81
|
"react-focus-on": "^3.3.0",
|
|
73
82
|
"react-helmet": "^6.1.0",
|
|
74
83
|
"react-live": "^2.1.2",
|
|
75
84
|
"react-measure": "^2.3.0",
|
|
76
85
|
"read-pkg-up": "^6.0.0",
|
|
77
86
|
"sentence-case": "^2.1.1",
|
|
78
|
-
"styled-components": "^
|
|
87
|
+
"styled-components": "^5.3.11",
|
|
79
88
|
"styled-system": "^5.0.18",
|
|
80
89
|
"worker-loader": "^3.0.2"
|
|
81
90
|
}
|
package/setup-tests.js
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
|
-
import '@testing-library/jest-dom
|
|
1
|
+
import '@testing-library/jest-dom'
|
|
2
2
|
|
|
3
3
|
// JSDOM doesn't mock ResizeObserver
|
|
4
4
|
// Copied from https://github.com/primer/react/blob/3fdae477d8067c5131d316548ce5b08aa1017355/src/utils/test-helpers.tsx
|
|
5
5
|
global.ResizeObserver = jest.fn().mockImplementation(() => {
|
|
6
6
|
return {
|
|
7
7
|
observe: jest.fn(),
|
|
8
|
-
disconnect: jest.fn()
|
|
8
|
+
disconnect: jest.fn(),
|
|
9
9
|
}
|
|
10
10
|
})
|
|
11
|
+
|
|
12
|
+
global.CSS = {
|
|
13
|
+
escape: jest.fn(),
|
|
14
|
+
supports: jest.fn().mockImplementation(() => {
|
|
15
|
+
return false
|
|
16
|
+
}),
|
|
17
|
+
}
|
|
@@ -3,27 +3,27 @@ import React from 'react'
|
|
|
3
3
|
import Contributors from '../contributors'
|
|
4
4
|
|
|
5
5
|
test('renders contributors', () => {
|
|
6
|
-
const {queryByText} = render(
|
|
6
|
+
const {queryByText, debug} = render(
|
|
7
7
|
<Contributors
|
|
8
8
|
contributors={[
|
|
9
9
|
{
|
|
10
10
|
login: 'colebemis',
|
|
11
11
|
latestCommit: {
|
|
12
12
|
url: '#',
|
|
13
|
-
date: '2019-08-15T23:40:19Z'
|
|
14
|
-
}
|
|
13
|
+
date: '2019-08-15T23:40:19Z',
|
|
14
|
+
},
|
|
15
15
|
},
|
|
16
16
|
{
|
|
17
17
|
login: 'emplums',
|
|
18
18
|
latestCommit: {
|
|
19
19
|
url: '#',
|
|
20
|
-
date: '2019-08-14T00:19:54Z'
|
|
21
|
-
}
|
|
22
|
-
}
|
|
20
|
+
date: '2019-08-14T00:19:54Z',
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
23
|
]}
|
|
24
|
-
|
|
24
|
+
/>,
|
|
25
25
|
)
|
|
26
|
-
|
|
26
|
+
debug()
|
|
27
27
|
expect(queryByText(/2 contributors/)).toBeInTheDocument()
|
|
28
28
|
expect(queryByText(/Last edited by/)).toBeInTheDocument()
|
|
29
29
|
expect(queryByText(/colebemis/)).toBeInTheDocument()
|
|
@@ -53,18 +53,18 @@ test('does not render duplicate contributors', () => {
|
|
|
53
53
|
login: 'colebemis',
|
|
54
54
|
latestCommit: {
|
|
55
55
|
url: '#',
|
|
56
|
-
date: '2019-08-15T23:40:19Z'
|
|
57
|
-
}
|
|
56
|
+
date: '2019-08-15T23:40:19Z',
|
|
57
|
+
},
|
|
58
58
|
},
|
|
59
59
|
{
|
|
60
60
|
login: 'colebemis',
|
|
61
61
|
latestCommit: {
|
|
62
62
|
url: '#',
|
|
63
|
-
date: '2019-08-14T00:19:54Z'
|
|
64
|
-
}
|
|
65
|
-
}
|
|
63
|
+
date: '2019-08-14T00:19:54Z',
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
66
|
]}
|
|
67
|
-
|
|
67
|
+
/>,
|
|
68
68
|
)
|
|
69
69
|
|
|
70
70
|
expect(queryByText(/1 contributor/)).toBeInTheDocument()
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {Label,
|
|
1
|
+
import {Label, Octicon} from '@primer/react'
|
|
2
2
|
import {AccessibilityInsetIcon} from '@primer/octicons-react'
|
|
3
3
|
import React from 'react'
|
|
4
4
|
|
|
@@ -14,10 +14,10 @@ function AccessibilityLabel({a11yReviewed, short}) {
|
|
|
14
14
|
gap: 2,
|
|
15
15
|
backgroundColor: 'done.subtle',
|
|
16
16
|
fontWeight: 'normal',
|
|
17
|
-
borderColor: 'transparent'
|
|
17
|
+
borderColor: 'transparent',
|
|
18
18
|
}}
|
|
19
19
|
>
|
|
20
|
-
<
|
|
20
|
+
<Octicon icon={AccessibilityInsetIcon} sx={{fill: 'done.fg'}} />
|
|
21
21
|
{short ? 'Reviewed' : 'Reviewed for accessibility'}
|
|
22
22
|
</Label>
|
|
23
23
|
) : (
|
|
@@ -26,7 +26,7 @@ function AccessibilityLabel({a11yReviewed, short}) {
|
|
|
26
26
|
sx={{
|
|
27
27
|
backgroundColor: 'neutral.subtle',
|
|
28
28
|
fontWeight: 'normal',
|
|
29
|
-
borderColor: 'transparent'
|
|
29
|
+
borderColor: 'transparent',
|
|
30
30
|
}}
|
|
31
31
|
>
|
|
32
32
|
{short ? 'Not reviewed' : 'Not reviewed for accessibility'}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {Button,
|
|
1
|
+
import {Button, Octicon} from '@primer/react'
|
|
2
2
|
import {CheckIcon, CopyIcon} from '@primer/octicons-react'
|
|
3
3
|
import copy from 'copy-to-clipboard'
|
|
4
4
|
import React from 'react'
|
|
@@ -24,9 +24,9 @@ function ClipboardCopy({value}) {
|
|
|
24
24
|
sx={{px: 2}}
|
|
25
25
|
>
|
|
26
26
|
{copied ? (
|
|
27
|
-
<
|
|
27
|
+
<Octicon icon={CheckIcon} sx={{color: 'success.fg'}} />
|
|
28
28
|
) : (
|
|
29
|
-
<
|
|
29
|
+
<Octicon icon={CopyIcon} sx={{color: 'fg.muted'}} />
|
|
30
30
|
)}
|
|
31
31
|
</Button>
|
|
32
32
|
)
|
package/src/components/code.js
CHANGED
|
@@ -24,7 +24,7 @@ function Code({className, children, live, highlight, noinline, metastring}) {
|
|
|
24
24
|
display: 'table',
|
|
25
25
|
tableLayout: 'fixed',
|
|
26
26
|
width: '100%',
|
|
27
|
-
position: 'relative'
|
|
27
|
+
position: 'relative',
|
|
28
28
|
}}
|
|
29
29
|
>
|
|
30
30
|
<Box sx={{top: 0, right: 0, p: 2, position: 'absolute'}}>
|
|
@@ -17,15 +17,11 @@ function Contributors({contributors}) {
|
|
|
17
17
|
{uniqueContributors.length} {pluralize('contributor', uniqueContributors.length)}
|
|
18
18
|
</Text>
|
|
19
19
|
{uniqueContributors.map(contributor => (
|
|
20
|
-
<
|
|
21
|
-
key={contributor.login}
|
|
22
|
-
href={`https://github.com/${contributor.login}`}
|
|
23
|
-
sx={{mr: 2, lineHeight: 'condensedUltra'}}
|
|
24
|
-
>
|
|
25
|
-
<Tooltip key={contributor.login} aria-label={contributor.login}>
|
|
20
|
+
<Tooltip key={contributor.login} aria-label={contributor.login} sx={{mr: 2, lineHeight: 'condensedUltra'}}>
|
|
21
|
+
<Link key={contributor.login} href={`https://github.com/${contributor.login}`}>
|
|
26
22
|
<Avatar src={`https://github.com/${contributor.login}.png?size=40`} alt={contributor.login} />
|
|
27
|
-
</
|
|
28
|
-
</
|
|
23
|
+
</Link>
|
|
24
|
+
</Tooltip>
|
|
29
25
|
))}
|
|
30
26
|
</Box>
|
|
31
27
|
|
|
@@ -10,7 +10,7 @@ export function DoDontContainer({stacked, children}) {
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
DoDontContainer.defaultProps = {
|
|
13
|
-
stacked: false
|
|
13
|
+
stacked: false,
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
export function Do(props) {
|
|
@@ -34,7 +34,7 @@ function DoDontBase({children, title, bg, borderColor, indented}) {
|
|
|
34
34
|
backgroundColor: bg,
|
|
35
35
|
borderRadius: '2',
|
|
36
36
|
color: 'fg.onEmphasis',
|
|
37
|
-
paddingX: '2'
|
|
37
|
+
paddingX: '2',
|
|
38
38
|
}}
|
|
39
39
|
>
|
|
40
40
|
<Text sx={{fontWeight: 'bold', fontSize: '1', color: 'fg.onEmphasis'}}>{title}</Text>
|
|
@@ -48,7 +48,7 @@ function DoDontBase({children, title, bg, borderColor, indented}) {
|
|
|
48
48
|
borderLeftWidth: '4px',
|
|
49
49
|
borderLeftStyle: 'solid',
|
|
50
50
|
borderLeftColor: borderColor,
|
|
51
|
-
paddingLeft: '3'
|
|
51
|
+
paddingLeft: '3',
|
|
52
52
|
}}
|
|
53
53
|
>
|
|
54
54
|
{children}
|
package/src/components/frame.js
CHANGED
|
@@ -3,14 +3,13 @@ import ReactDOM from 'react-dom'
|
|
|
3
3
|
import {StyleSheetManager} from 'styled-components'
|
|
4
4
|
import Measure from 'react-measure'
|
|
5
5
|
|
|
6
|
-
function Frame({children}) {
|
|
6
|
+
function Frame({title = 'Code frame', children}) {
|
|
7
7
|
const [height, setHeight] = React.useState('auto')
|
|
8
8
|
const [iframeRef, setIframeRef] = React.useState(null)
|
|
9
9
|
const contentDocument = iframeRef ? iframeRef.contentWindow.document : null
|
|
10
10
|
|
|
11
11
|
return (
|
|
12
|
-
|
|
13
|
-
<iframe ref={setIframeRef} style={{width: '100%', border: 0, borderRadius: 6, height}}>
|
|
12
|
+
<iframe ref={setIframeRef} style={{width: '100%', border: 0, borderRadius: 6, height}} title={title}>
|
|
14
13
|
{
|
|
15
14
|
// By default, styled-components injects styles in the head of the page.
|
|
16
15
|
// However, styles from the page's head don't apply inside iframes.
|
|
@@ -29,7 +28,7 @@ function Frame({children}) {
|
|
|
29
28
|
{({measureRef}) => <div ref={measureRef}>{children}</div>}
|
|
30
29
|
</Measure>
|
|
31
30
|
</StyleSheetManager>,
|
|
32
|
-
contentDocument.body
|
|
31
|
+
contentDocument.body,
|
|
33
32
|
)
|
|
34
33
|
}
|
|
35
34
|
</iframe>
|
package/src/components/head.js
CHANGED
|
@@ -15,6 +15,12 @@ function Head(props) {
|
|
|
15
15
|
<meta property="og:description" content={description} />
|
|
16
16
|
<meta property="og:image" content={siteMetadata.imageUrl} />
|
|
17
17
|
<meta property="twitter:card" content="summary_large_image" />
|
|
18
|
+
{siteMetadata.primerTracking ? (
|
|
19
|
+
<>
|
|
20
|
+
<meta name="ha-url" content="https://collector.githubapp.com/primer/collect" />
|
|
21
|
+
<script src="https://analytics.githubassets.com/hydro-marketing.min.js"></script>
|
|
22
|
+
</>
|
|
23
|
+
) : null}
|
|
18
24
|
</Helmet>
|
|
19
25
|
)
|
|
20
26
|
}
|
package/src/components/header.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {MarkGithubIcon, SearchIcon, ThreeBarsIcon} from '@primer/octicons-react'
|
|
2
|
-
import {Box, Button, Link,
|
|
2
|
+
import {Box, Button, Link, Octicon, Text, ThemeProvider, useTheme, UnderlineNav} from '@primer/react'
|
|
3
3
|
import VisuallyHidden from './visually-hidden'
|
|
4
4
|
import {Link as GatsbyLink} from 'gatsby'
|
|
5
5
|
import React from 'react'
|
|
@@ -33,7 +33,7 @@ function Header({isSearchEnabled, path}) {
|
|
|
33
33
|
justifyContent: 'space-between',
|
|
34
34
|
bg: 'canvas.default',
|
|
35
35
|
border: '1px solid',
|
|
36
|
-
borderColor: 'border.muted'
|
|
36
|
+
borderColor: 'border.muted',
|
|
37
37
|
}}
|
|
38
38
|
>
|
|
39
39
|
<SkipLink />
|
|
@@ -43,10 +43,10 @@ function Header({isSearchEnabled, path}) {
|
|
|
43
43
|
sx={{
|
|
44
44
|
color: 'fg.default',
|
|
45
45
|
mr: 3,
|
|
46
|
-
lineHeight: 'condensedUltra'
|
|
46
|
+
lineHeight: 'condensedUltra',
|
|
47
47
|
}}
|
|
48
48
|
>
|
|
49
|
-
<
|
|
49
|
+
<Octicon icon={MarkGithubIcon} size="24px" />
|
|
50
50
|
</Link>
|
|
51
51
|
{siteMetadata.header.title ? (
|
|
52
52
|
<Link
|
|
@@ -59,8 +59,8 @@ function Header({isSearchEnabled, path}) {
|
|
|
59
59
|
siteMetadata.shortName ? 'none' : 'inline-block',
|
|
60
60
|
null,
|
|
61
61
|
null,
|
|
62
|
-
'inline-block'
|
|
63
|
-
]
|
|
62
|
+
'inline-block',
|
|
63
|
+
],
|
|
64
64
|
}}
|
|
65
65
|
>
|
|
66
66
|
{siteMetadata.header.title}
|
|
@@ -73,7 +73,7 @@ function Header({isSearchEnabled, path}) {
|
|
|
73
73
|
sx={{
|
|
74
74
|
display: ['none', null, null, 'inline-block'],
|
|
75
75
|
color: 'fg.default',
|
|
76
|
-
mx: 2
|
|
76
|
+
mx: 2,
|
|
77
77
|
}}
|
|
78
78
|
>
|
|
79
79
|
/
|
|
@@ -84,7 +84,7 @@ function Header({isSearchEnabled, path}) {
|
|
|
84
84
|
to="/"
|
|
85
85
|
sx={{
|
|
86
86
|
fontWeight: 'bold',
|
|
87
|
-
color: 'fg.default'
|
|
87
|
+
color: 'fg.default',
|
|
88
88
|
}}
|
|
89
89
|
>
|
|
90
90
|
{siteMetadata.shortName}
|
|
@@ -109,7 +109,7 @@ function Header({isSearchEnabled, path}) {
|
|
|
109
109
|
aria-expanded={isMobileSearchOpen}
|
|
110
110
|
onClick={() => setIsMobileSearchOpen(true)}
|
|
111
111
|
sx={{
|
|
112
|
-
ml: 3
|
|
112
|
+
ml: 3,
|
|
113
113
|
}}
|
|
114
114
|
>
|
|
115
115
|
<SearchIcon />
|
|
@@ -122,7 +122,7 @@ function Header({isSearchEnabled, path}) {
|
|
|
122
122
|
aria-expanded={isNavDrawerOpen}
|
|
123
123
|
onClick={() => setIsNavDrawerOpen(true)}
|
|
124
124
|
sx={{
|
|
125
|
-
ml: 3
|
|
125
|
+
ml: 3,
|
|
126
126
|
}}
|
|
127
127
|
>
|
|
128
128
|
<ThreeBarsIcon />
|
|
@@ -137,30 +137,26 @@ function Header({isSearchEnabled, path}) {
|
|
|
137
137
|
}
|
|
138
138
|
|
|
139
139
|
Header.defaultProps = {
|
|
140
|
-
isSearchEnabled: true
|
|
140
|
+
isSearchEnabled: true,
|
|
141
141
|
}
|
|
142
142
|
|
|
143
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
|
-
|
|
148
144
|
return (
|
|
149
145
|
<>
|
|
150
146
|
<VisuallyHidden>
|
|
151
147
|
<h3 aria-labelledby="site-header">{siteMetadata.header.title} </h3>
|
|
152
148
|
</VisuallyHidden>
|
|
153
|
-
<UnderlineNav aria-label="
|
|
149
|
+
<UnderlineNav aria-label="Main navigation" sx={{border: 'none'}}>
|
|
154
150
|
{items.map((item, index) => {
|
|
155
151
|
return (
|
|
156
|
-
<UnderlineNav.
|
|
152
|
+
<UnderlineNav.Item
|
|
157
153
|
key={index}
|
|
158
154
|
href={item.url}
|
|
159
155
|
selected={item.url === siteMetadata.header.url + (pathPrefix || '') + (path || '')}
|
|
160
156
|
sx={{fontSize: 2, lineHeight: 'condensed'}}
|
|
161
157
|
>
|
|
162
158
|
{item.title}
|
|
163
|
-
</UnderlineNav.
|
|
159
|
+
</UnderlineNav.Item>
|
|
164
160
|
)
|
|
165
161
|
})}
|
|
166
162
|
</UnderlineNav>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {Heading, Link,
|
|
1
|
+
import {Heading, Link, Octicon} 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'
|
|
@@ -8,8 +8,8 @@ import styled from 'styled-components'
|
|
|
8
8
|
import {HEADER_HEIGHT} from './header'
|
|
9
9
|
|
|
10
10
|
const StyledHeading = styled(Heading)`
|
|
11
|
-
margin-top: ${themeGet('space.
|
|
12
|
-
margin-bottom: ${themeGet('space.
|
|
11
|
+
margin-top: ${themeGet('space.8')};
|
|
12
|
+
margin-bottom: ${themeGet('space.4')};
|
|
13
13
|
scroll-margin-top: ${HEADER_HEIGHT + 24}px;
|
|
14
14
|
line-height: ${themeGet('lineHeights.condensed')};
|
|
15
15
|
|
|
@@ -37,19 +37,19 @@ function MarkdownHeading({children, ...props}) {
|
|
|
37
37
|
sx={{
|
|
38
38
|
color: 'inherit',
|
|
39
39
|
'&:hover, &:focus': {
|
|
40
|
-
textDecoration: 'none'
|
|
41
|
-
}
|
|
40
|
+
textDecoration: 'none',
|
|
41
|
+
},
|
|
42
42
|
}}
|
|
43
43
|
>
|
|
44
44
|
{children}
|
|
45
|
-
<
|
|
45
|
+
<Octicon
|
|
46
46
|
icon={LinkIcon}
|
|
47
47
|
className="octicon-link"
|
|
48
48
|
sx={{
|
|
49
49
|
ml: 2,
|
|
50
50
|
color: 'fg.muted',
|
|
51
51
|
// !important is needed here to override default icon styles
|
|
52
|
-
verticalAlign: 'middle !important'
|
|
52
|
+
verticalAlign: 'middle !important',
|
|
53
53
|
}}
|
|
54
54
|
/>
|
|
55
55
|
</Link>
|
|
@@ -58,13 +58,13 @@ function MarkdownHeading({children, ...props}) {
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
const StyledH1 = styled(StyledHeading).attrs({as: 'h1'})`
|
|
61
|
-
padding-bottom: ${themeGet('space.
|
|
61
|
+
padding-bottom: ${themeGet('space.3')};
|
|
62
62
|
font-size: ${themeGet('fontSizes.7')};
|
|
63
63
|
border-bottom: 1px solid ${themeGet('colors.border.default')};
|
|
64
64
|
`
|
|
65
65
|
|
|
66
66
|
const StyledH2 = styled(StyledHeading).attrs({as: 'h2'})`
|
|
67
|
-
padding-bottom: ${themeGet('space.
|
|
67
|
+
padding-bottom: ${themeGet('space.3')};
|
|
68
68
|
font-size: ${themeGet('fontSizes.4')};
|
|
69
69
|
border-bottom: 1px solid ${themeGet('colors.border.default')};
|
|
70
70
|
font-weight: ${themeGet('fontWeights.semibold')};
|
|
@@ -10,7 +10,7 @@ function ImageContainer({children}) {
|
|
|
10
10
|
borderWidth: '1px',
|
|
11
11
|
borderStyle: 'solid',
|
|
12
12
|
borderColor: 'border.default',
|
|
13
|
-
borderRadius: 2
|
|
13
|
+
borderRadius: 2,
|
|
14
14
|
}}
|
|
15
15
|
>
|
|
16
16
|
<Box sx={{img: {maxWidth: '100%'}, justifyContent: 'center', display: 'flex'}}>{children}</Box>
|
package/src/components/layout.js
CHANGED
|
@@ -54,7 +54,7 @@ function Layout({children, pageContext, path}) {
|
|
|
54
54
|
storybook,
|
|
55
55
|
lookbook,
|
|
56
56
|
additionalContributors,
|
|
57
|
-
componentId
|
|
57
|
+
componentId,
|
|
58
58
|
} = pageContext.frontmatter
|
|
59
59
|
|
|
60
60
|
if (!additionalContributors) {
|
|
@@ -86,7 +86,7 @@ function Layout({children, pageContext, path}) {
|
|
|
86
86
|
maxWidth: '1200px',
|
|
87
87
|
mx: 'auto',
|
|
88
88
|
width: '100%',
|
|
89
|
-
p: [4, 5, 6, 7]
|
|
89
|
+
p: [4, 5, 6, 7],
|
|
90
90
|
}}
|
|
91
91
|
>
|
|
92
92
|
{pageContext.tableOfContents.items ? (
|
|
@@ -98,7 +98,7 @@ function Layout({children, pageContext, path}) {
|
|
|
98
98
|
display: ['none', null, 'block'],
|
|
99
99
|
position: 'sticky',
|
|
100
100
|
top: HEADER_HEIGHT + 48,
|
|
101
|
-
maxHeight: `calc(100vh - ${HEADER_HEIGHT}px - 48px)
|
|
101
|
+
maxHeight: `calc(100vh - ${HEADER_HEIGHT}px - 48px)`,
|
|
102
102
|
}}
|
|
103
103
|
css={{gridArea: 'table-of-contents', overflow: 'auto'}}
|
|
104
104
|
>
|
|
@@ -133,7 +133,7 @@ function Layout({children, pageContext, path}) {
|
|
|
133
133
|
mt: 2,
|
|
134
134
|
rowGap: 3,
|
|
135
135
|
alignItems: 'center',
|
|
136
|
-
fontSize: 1
|
|
136
|
+
fontSize: 1,
|
|
137
137
|
}}
|
|
138
138
|
>
|
|
139
139
|
{status ? (
|
|
@@ -146,7 +146,7 @@ function Layout({children, pageContext, path}) {
|
|
|
146
146
|
m: 0,
|
|
147
147
|
p: 0,
|
|
148
148
|
paddingInline: 0,
|
|
149
|
-
listStyle: 'none'
|
|
149
|
+
listStyle: 'none',
|
|
150
150
|
}}
|
|
151
151
|
>
|
|
152
152
|
<li>
|
|
@@ -168,7 +168,7 @@ function Layout({children, pageContext, path}) {
|
|
|
168
168
|
m: 0,
|
|
169
169
|
p: 0,
|
|
170
170
|
paddingInline: 0,
|
|
171
|
-
listStyle: 'none'
|
|
171
|
+
listStyle: 'none',
|
|
172
172
|
}}
|
|
173
173
|
>
|
|
174
174
|
{source ? <SourceLink href={source} /> : null}
|
|
@@ -191,7 +191,7 @@ function Layout({children, pageContext, path}) {
|
|
|
191
191
|
bg: 'canvas.subtle',
|
|
192
192
|
borderWidth: '1px',
|
|
193
193
|
borderStyle: 'solid',
|
|
194
|
-
borderRadius: 2
|
|
194
|
+
borderRadius: 2,
|
|
195
195
|
}}
|
|
196
196
|
>
|
|
197
197
|
<Box sx={{px: 3, py: 2}}>
|
package/src/components/list.js
CHANGED
|
@@ -13,7 +13,7 @@ import themeGet from '@styled-system/theme-get'
|
|
|
13
13
|
|
|
14
14
|
const languageTransformers = {
|
|
15
15
|
html: html => htmlToJsx(html),
|
|
16
|
-
jsx: jsx => wrapWithFragment(jsx)
|
|
16
|
+
jsx: jsx => wrapWithFragment(jsx),
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
function htmlToJsx(html) {
|
|
@@ -93,7 +93,7 @@ function LiveCode({code, language, highlight, noinline, metastring}) {
|
|
|
93
93
|
borderColor: 'border.default',
|
|
94
94
|
borderTopRightRadius: 2,
|
|
95
95
|
borderTopLeftRadius: 2,
|
|
96
|
-
display: 'flex'
|
|
96
|
+
display: 'flex',
|
|
97
97
|
}}
|
|
98
98
|
>
|
|
99
99
|
<LivePreviewWrapper>
|
|
@@ -114,7 +114,7 @@ function LiveCode({code, language, highlight, noinline, metastring}) {
|
|
|
114
114
|
borderBottomRightRadius: theme.radii[2],
|
|
115
115
|
border: '1px solid',
|
|
116
116
|
borderTop: 0,
|
|
117
|
-
borderColor: theme.colors.border.default
|
|
117
|
+
borderColor: theme.colors.border.default,
|
|
118
118
|
}}
|
|
119
119
|
/>
|
|
120
120
|
</LineHighlighter>
|
|
@@ -52,7 +52,7 @@ function MobileSearch({isOpen, onDismiss}) {
|
|
|
52
52
|
bottom: 0,
|
|
53
53
|
bg: 'primer.canvas.backdrop',
|
|
54
54
|
zIndex: -1,
|
|
55
|
-
position: 'absolute'
|
|
55
|
+
position: 'absolute',
|
|
56
56
|
}}
|
|
57
57
|
/>
|
|
58
58
|
<Downshift
|
|
@@ -72,7 +72,7 @@ function MobileSearch({isOpen, onDismiss}) {
|
|
|
72
72
|
<Box
|
|
73
73
|
{...getRootProps({
|
|
74
74
|
flexDirection: 'column',
|
|
75
|
-
height: isMenuOpen ? '100%' : 'auto'
|
|
75
|
+
height: isMenuOpen ? '100%' : 'auto',
|
|
76
76
|
})}
|
|
77
77
|
sx={{display: 'flex'}}
|
|
78
78
|
>
|
|
@@ -88,7 +88,7 @@ function MobileSearch({isOpen, onDismiss}) {
|
|
|
88
88
|
leadingVisual={SearchIcon}
|
|
89
89
|
{...getInputProps({
|
|
90
90
|
placeholder: `Search`,
|
|
91
|
-
sx: {width: '100%'}
|
|
91
|
+
sx: {width: '100%'},
|
|
92
92
|
})}
|
|
93
93
|
/>
|
|
94
94
|
</motion.div>
|
|
@@ -107,8 +107,8 @@ function MobileSearch({isOpen, onDismiss}) {
|
|
|
107
107
|
flex: '1 1 auto',
|
|
108
108
|
style: {
|
|
109
109
|
overflow: 'auto',
|
|
110
|
-
WebkitOverflowScrolling: 'touch'
|
|
111
|
-
}
|
|
110
|
+
WebkitOverflowScrolling: 'touch',
|
|
111
|
+
},
|
|
112
112
|
})}
|
|
113
113
|
>
|
|
114
114
|
<SearchResults
|
|
@@ -56,7 +56,7 @@ function NavDrawer({isOpen, onDismiss}) {
|
|
|
56
56
|
borderRadius: 0,
|
|
57
57
|
borderBottomWidth: 1,
|
|
58
58
|
borderColor: 'border.muted',
|
|
59
|
-
borderStyle: 'solid'
|
|
59
|
+
borderStyle: 'solid',
|
|
60
60
|
}}
|
|
61
61
|
>
|
|
62
62
|
<Box sx={{py: 3, pl: 4, pr: 3, alignItems: 'center', justifyContent: 'space-between', display: 'flex'}}>
|
|
@@ -80,7 +80,7 @@ function NavDrawer({isOpen, onDismiss}) {
|
|
|
80
80
|
flex: '1 0 auto',
|
|
81
81
|
color: 'fg.default',
|
|
82
82
|
bg: 'canvas.default',
|
|
83
|
-
display: 'flex'
|
|
83
|
+
display: 'flex',
|
|
84
84
|
}}
|
|
85
85
|
>
|
|
86
86
|
<Link
|
|
@@ -113,14 +113,21 @@ function PrimerNavItems({items}) {
|
|
|
113
113
|
borderColor: 'border.muted',
|
|
114
114
|
px: 4,
|
|
115
115
|
py: 3,
|
|
116
|
-
borderStyle: 'solid'
|
|
116
|
+
borderStyle: 'solid',
|
|
117
117
|
}}
|
|
118
118
|
>
|
|
119
119
|
{item.children ? (
|
|
120
120
|
<Details key={index}>
|
|
121
121
|
{({open, toggle}) => (
|
|
122
122
|
<>
|
|
123
|
-
|
|
123
|
+
{/*eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions */}
|
|
124
|
+
<summary
|
|
125
|
+
//The following line of code has only an onClick event and no keyboard event and its a non static
|
|
126
|
+
//element. This is because we don't want it to be a tabstop thats tedious for keyboard users and sr's.
|
|
127
|
+
//This needs to be a hard exception
|
|
128
|
+
onClick={toggle}
|
|
129
|
+
style={{cursor: 'pointer'}}
|
|
130
|
+
>
|
|
124
131
|
<Box sx={{alignItems: 'center', justifyContent: 'space-between', display: 'flex'}}>
|
|
125
132
|
<Text>{item.title}</Text>
|
|
126
133
|
{open ? <ChevronUpIcon /> : <ChevronDownIcon />}
|
package/src/components/note.js
CHANGED
|
@@ -16,22 +16,22 @@ const Note = styled.div`
|
|
|
16
16
|
variants: {
|
|
17
17
|
info: {
|
|
18
18
|
borderColor: 'accent.muted',
|
|
19
|
-
bg: 'accent.subtle'
|
|
19
|
+
bg: 'accent.subtle',
|
|
20
20
|
},
|
|
21
21
|
warning: {
|
|
22
22
|
borderColor: 'attention.muted',
|
|
23
|
-
bg: 'attention.subtle'
|
|
23
|
+
bg: 'attention.subtle',
|
|
24
24
|
},
|
|
25
25
|
danger: {
|
|
26
26
|
borderColor: 'danger.muted',
|
|
27
|
-
bg: 'danger.subtle'
|
|
28
|
-
}
|
|
29
|
-
}
|
|
27
|
+
bg: 'danger.subtle',
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
30
|
})}
|
|
31
31
|
`
|
|
32
32
|
|
|
33
33
|
Note.defaultProps = {
|
|
34
|
-
variant: 'info'
|
|
34
|
+
variant: 'info',
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
export default Note
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {PencilIcon} from '@primer/octicons-react'
|
|
2
|
-
import {Box, Link,
|
|
2
|
+
import {Box, Link, Octicon} from '@primer/react'
|
|
3
3
|
import React from 'react'
|
|
4
4
|
import Contributors from './contributors'
|
|
5
5
|
import VisuallyHidden from './visually-hidden'
|
|
@@ -16,7 +16,7 @@ function PageFooter({editUrl, contributors}) {
|
|
|
16
16
|
mt: 8,
|
|
17
17
|
py: 5,
|
|
18
18
|
borderStyle: 'solid',
|
|
19
|
-
borderColor: 'border.default'
|
|
19
|
+
borderColor: 'border.default',
|
|
20
20
|
}}
|
|
21
21
|
>
|
|
22
22
|
<VisuallyHidden>
|
|
@@ -25,7 +25,7 @@ function PageFooter({editUrl, contributors}) {
|
|
|
25
25
|
<Box sx={{gridGap: 4, display: 'grid'}}>
|
|
26
26
|
{editUrl ? (
|
|
27
27
|
<Link href={editUrl}>
|
|
28
|
-
<
|
|
28
|
+
<Octicon icon={PencilIcon} sx={{mr: 2}} />
|
|
29
29
|
Edit this page on GitHub
|
|
30
30
|
</Link>
|
|
31
31
|
) : null}
|
|
@@ -37,7 +37,7 @@ function PageFooter({editUrl, contributors}) {
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
PageFooter.defaultProps = {
|
|
40
|
-
contributors: []
|
|
40
|
+
contributors: [],
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
export default PageFooter
|
|
@@ -23,7 +23,7 @@ function SearchResults({results, getItemProps, highlightedIndex}) {
|
|
|
23
23
|
fontSize: 1,
|
|
24
24
|
bg: highlightedIndex === index ? 'neutral.muted' : 'transparent',
|
|
25
25
|
style: {cursor: 'pointer'},
|
|
26
|
-
borderRadius: 2
|
|
26
|
+
borderRadius: 2,
|
|
27
27
|
})}
|
|
28
28
|
sx={{display: 'flex'}}
|
|
29
29
|
>
|
|
@@ -42,7 +42,7 @@ function getBreadcrumbs(siteTitle, path) {
|
|
|
42
42
|
// The last title will be displayed separately, so we exclude it
|
|
43
43
|
// from the breadcrumbs to avoid displaying it twice.
|
|
44
44
|
.slice(0, -1)
|
|
45
|
-
.map(sentenceCase)
|
|
45
|
+
.map(sentenceCase),
|
|
46
46
|
]
|
|
47
47
|
}
|
|
48
48
|
|
package/src/components/search.js
CHANGED
|
@@ -51,8 +51,8 @@ function Search() {
|
|
|
51
51
|
{...getInputProps({
|
|
52
52
|
placeholder: `Search ${siteMetadata.title}`,
|
|
53
53
|
sx: {
|
|
54
|
-
width: 300
|
|
55
|
-
}
|
|
54
|
+
width: 300,
|
|
55
|
+
},
|
|
56
56
|
})}
|
|
57
57
|
/>
|
|
58
58
|
{isOpen ? (
|
|
@@ -61,7 +61,7 @@ function Search() {
|
|
|
61
61
|
position: 'absolute',
|
|
62
62
|
left: 0,
|
|
63
63
|
right: 0,
|
|
64
|
-
pt: 2
|
|
64
|
+
pt: 2,
|
|
65
65
|
})}
|
|
66
66
|
>
|
|
67
67
|
<ThemeProvider colorMode="day">
|
|
@@ -76,7 +76,7 @@ function Search() {
|
|
|
76
76
|
bg: 'canvas.overlay',
|
|
77
77
|
borderRadius: '12px',
|
|
78
78
|
borderWidth: '1px',
|
|
79
|
-
borderStyle: 'solid'
|
|
79
|
+
borderStyle: 'solid',
|
|
80
80
|
}}
|
|
81
81
|
>
|
|
82
82
|
<SearchResults results={results} getItemProps={getItemProps} highlightedIndex={highlightedIndex} />
|
|
@@ -10,7 +10,7 @@ function usePersistentScroll(id) {
|
|
|
10
10
|
const handleScroll = React.useCallback(
|
|
11
11
|
// Save scroll position in session storage on every scroll change
|
|
12
12
|
event => window.sessionStorage.setItem(id, event.target.scrollTop),
|
|
13
|
-
[id]
|
|
13
|
+
[id],
|
|
14
14
|
)
|
|
15
15
|
|
|
16
16
|
React.useLayoutEffect(() => {
|
|
@@ -24,7 +24,7 @@ function usePersistentScroll(id) {
|
|
|
24
24
|
// Return props to spread onto the scroll container
|
|
25
25
|
return {
|
|
26
26
|
ref,
|
|
27
|
-
onScroll: handleScroll
|
|
27
|
+
onScroll: handleScroll,
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
|
|
@@ -37,7 +37,7 @@ function Sidebar() {
|
|
|
37
37
|
position: 'sticky',
|
|
38
38
|
top: HEADER_HEIGHT,
|
|
39
39
|
height: `calc(100vh - ${HEADER_HEIGHT}px)`,
|
|
40
|
-
width: 260
|
|
40
|
+
width: 260,
|
|
41
41
|
}}
|
|
42
42
|
>
|
|
43
43
|
<Box
|
|
@@ -50,7 +50,7 @@ function Sidebar() {
|
|
|
50
50
|
height: '100%',
|
|
51
51
|
borderStyle: 'solid',
|
|
52
52
|
borderColor: 'border.subtle',
|
|
53
|
-
px: 2
|
|
53
|
+
px: 2,
|
|
54
54
|
}}
|
|
55
55
|
>
|
|
56
56
|
<Box sx={{flexDirection: 'column', display: 'flex'}}>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {Label,
|
|
1
|
+
import {Label, Octicon} from '@primer/react'
|
|
2
2
|
import {DotFillIcon} from '@primer/octicons-react'
|
|
3
3
|
import React from 'react'
|
|
4
4
|
|
|
@@ -6,14 +6,14 @@ const STATUS_COLORS = {
|
|
|
6
6
|
alpha: 'severe.fg',
|
|
7
7
|
beta: 'attention.fg',
|
|
8
8
|
stable: 'success.fg',
|
|
9
|
-
deprecated: 'danger.fg'
|
|
9
|
+
deprecated: 'danger.fg',
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
const STATUS_BACKGROUND = {
|
|
13
13
|
alpha: 'severe.subtle',
|
|
14
14
|
beta: 'attention.subtle',
|
|
15
15
|
stable: 'success.subtle',
|
|
16
|
-
deprecated: 'danger.subtle'
|
|
16
|
+
deprecated: 'danger.subtle',
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
function getStatusColor(status) {
|
|
@@ -34,10 +34,10 @@ function StatusLabel({status}) {
|
|
|
34
34
|
gap: 1,
|
|
35
35
|
backgroundColor: getStatusBackgroundColor(status),
|
|
36
36
|
borderColor: 'transparent',
|
|
37
|
-
fontWeight: 'normal'
|
|
37
|
+
fontWeight: 'normal',
|
|
38
38
|
}}
|
|
39
39
|
>
|
|
40
|
-
<
|
|
40
|
+
<Octicon icon={DotFillIcon} sx={{color: getStatusColor(status)}} />
|
|
41
41
|
{status}
|
|
42
42
|
</Label>
|
|
43
43
|
)
|
|
@@ -14,7 +14,7 @@ import HorizontalRule from './horizontal-rule'
|
|
|
14
14
|
import Image from './image'
|
|
15
15
|
import ImageContainer from './image-container'
|
|
16
16
|
import InlineCode from './inline-code'
|
|
17
|
-
import
|
|
17
|
+
import {OL, UL} from './list'
|
|
18
18
|
import Note from './note'
|
|
19
19
|
import Paragraph from './paragraph'
|
|
20
20
|
import Superscript from './superscript'
|
|
@@ -37,8 +37,8 @@ const components = {
|
|
|
37
37
|
h4: H4,
|
|
38
38
|
h5: H5,
|
|
39
39
|
h6: H6,
|
|
40
|
-
ul:
|
|
41
|
-
ol:
|
|
40
|
+
ul: UL,
|
|
41
|
+
ol: OL,
|
|
42
42
|
dl: DescriptionList,
|
|
43
43
|
|
|
44
44
|
// Custom components
|
|
@@ -48,7 +48,7 @@ const components = {
|
|
|
48
48
|
DoDontContainer,
|
|
49
49
|
Caption,
|
|
50
50
|
ImageContainer,
|
|
51
|
-
...mdxComponents
|
|
51
|
+
...mdxComponents,
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
function wrapRootElement({element}) {
|
package/src/github.js
CHANGED
|
@@ -1,63 +1,63 @@
|
|
|
1
1
|
export default {
|
|
2
2
|
plain: {
|
|
3
3
|
color: '#393A34',
|
|
4
|
-
backgroundColor: '#f6f8fa'
|
|
4
|
+
backgroundColor: '#f6f8fa',
|
|
5
5
|
},
|
|
6
6
|
styles: [
|
|
7
7
|
{
|
|
8
8
|
types: ['comment', 'prolog', 'doctype', 'cdata'],
|
|
9
9
|
style: {
|
|
10
10
|
color: '#999988',
|
|
11
|
-
fontStyle: 'italic'
|
|
12
|
-
}
|
|
11
|
+
fontStyle: 'italic',
|
|
12
|
+
},
|
|
13
13
|
},
|
|
14
14
|
{
|
|
15
15
|
types: ['namespace'],
|
|
16
16
|
style: {
|
|
17
|
-
opacity: 0.7
|
|
18
|
-
}
|
|
17
|
+
opacity: 0.7,
|
|
18
|
+
},
|
|
19
19
|
},
|
|
20
20
|
{
|
|
21
21
|
types: ['string', 'attr-value'],
|
|
22
22
|
style: {
|
|
23
|
-
color: '#e3116c'
|
|
24
|
-
}
|
|
23
|
+
color: '#e3116c',
|
|
24
|
+
},
|
|
25
25
|
},
|
|
26
26
|
{
|
|
27
27
|
types: ['punctuation', 'operator'],
|
|
28
28
|
style: {
|
|
29
|
-
color: '#393A34'
|
|
30
|
-
}
|
|
29
|
+
color: '#393A34',
|
|
30
|
+
},
|
|
31
31
|
},
|
|
32
32
|
{
|
|
33
33
|
types: ['entity', 'url', 'symbol', 'number', 'boolean', 'variable', 'constant', 'property', 'regex', 'inserted'],
|
|
34
34
|
style: {
|
|
35
|
-
color: '#36acaa'
|
|
36
|
-
}
|
|
35
|
+
color: '#36acaa',
|
|
36
|
+
},
|
|
37
37
|
},
|
|
38
38
|
{
|
|
39
39
|
types: ['atrule', 'keyword', 'attr-name', 'selector'],
|
|
40
40
|
style: {
|
|
41
|
-
color: '#00a4db'
|
|
42
|
-
}
|
|
41
|
+
color: '#00a4db',
|
|
42
|
+
},
|
|
43
43
|
},
|
|
44
44
|
{
|
|
45
45
|
types: ['function', 'deleted', 'tag'],
|
|
46
46
|
style: {
|
|
47
|
-
color: '#d73a49'
|
|
48
|
-
}
|
|
47
|
+
color: '#d73a49',
|
|
48
|
+
},
|
|
49
49
|
},
|
|
50
50
|
{
|
|
51
51
|
types: ['function-variable'],
|
|
52
52
|
style: {
|
|
53
|
-
color: '#6f42c1'
|
|
54
|
-
}
|
|
53
|
+
color: '#6f42c1',
|
|
54
|
+
},
|
|
55
55
|
},
|
|
56
56
|
{
|
|
57
57
|
types: ['tag', 'selector', 'keyword'],
|
|
58
58
|
style: {
|
|
59
|
-
color: '#00009f'
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
]
|
|
59
|
+
color: '#00009f',
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
],
|
|
63
63
|
}
|
package/src/search.worker.js
CHANGED
|
@@ -18,7 +18,7 @@ import debounce from 'lodash.debounce'
|
|
|
18
18
|
postMessage({results: results, query: query})
|
|
19
19
|
},
|
|
20
20
|
50,
|
|
21
|
-
{leading: true, trailing: true}
|
|
21
|
+
{leading: true, trailing: true},
|
|
22
22
|
)
|
|
23
23
|
|
|
24
24
|
onmessage = function ({data}) {
|
|
@@ -26,7 +26,7 @@ import debounce from 'lodash.debounce'
|
|
|
26
26
|
fuse = new Fuse(data.list, {
|
|
27
27
|
threshold: 0.2,
|
|
28
28
|
keys: ['title', 'rawBody'],
|
|
29
|
-
tokenize: true
|
|
29
|
+
tokenize: true,
|
|
30
30
|
})
|
|
31
31
|
} else if (data.query) {
|
|
32
32
|
performSearch(data.query)
|
package/src/use-search.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {graphql, useStaticQuery} from 'gatsby'
|
|
2
|
-
import path from 'path'
|
|
2
|
+
import path from 'path-browserify'
|
|
3
3
|
import React from 'react'
|
|
4
4
|
import SearchWorker from 'worker-loader!./search.worker.js'
|
|
5
5
|
|
|
@@ -40,10 +40,10 @@ function useSearch(query) {
|
|
|
40
40
|
const list = React.useMemo(() => {
|
|
41
41
|
const results = data.allMdx.nodes.map(node => ({
|
|
42
42
|
path: ensureAbsolute(
|
|
43
|
-
path.join(node.parent.relativeDirectory, node.parent.name === 'index' ? '/' : node.parent.name)
|
|
43
|
+
path.join(node.parent.relativeDirectory, node.parent.name === 'index' ? '/' : node.parent.name),
|
|
44
44
|
),
|
|
45
45
|
title: node.frontmatter.title,
|
|
46
|
-
rawBody: node.rawBody
|
|
46
|
+
rawBody: node.rawBody,
|
|
47
47
|
}))
|
|
48
48
|
|
|
49
49
|
if (data.allCustomSearchDoc.nodes) {
|