@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/.eslintrc.json
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,44 @@
|
|
|
1
1
|
# @primer/gatsby-theme-doctocat
|
|
2
2
|
|
|
3
|
+
## 4.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [`1022d1c`](https://github.com/primer/doctocat/commit/1022d1c92588f1e4fed4bdacec30fd5d11256412) [#362](https://github.com/primer/doctocat/pull/362) Thanks [@siddharthkp](https://github.com/siddharthkp)! - Drop support for node 12
|
|
8
|
+
|
|
9
|
+
* [`5f4426c`](https://github.com/primer/doctocat/commit/5f4426cc0cec6201600241bc753e5c7c9bf188a6) [#427](https://github.com/primer/doctocat/pull/427) Thanks [@colebemis](https://github.com/colebemis)! - Items in [`nav.yml`](https://primer.style/doctocat/usage/customization#side-navigation) that contain `children` no longer render as links, meaning the `url` property will be ignored.
|
|
10
|
+
|
|
11
|
+
```diff
|
|
12
|
+
# nav.yml
|
|
13
|
+
– title: Components
|
|
14
|
+
- url: /components
|
|
15
|
+
children:
|
|
16
|
+
— title: Avatar
|
|
17
|
+
url: /Avatar
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- [`facde5a`](https://github.com/primer/doctocat/commit/facde5a56119b160f98b8b01302e3508392c2146) [#330](https://github.com/primer/doctocat/pull/330) Thanks [@siddharthkp](https://github.com/siddharthkp)! - Vertically-center align images in table
|
|
23
|
+
|
|
24
|
+
## 3.3.0
|
|
25
|
+
|
|
26
|
+
### Minor Changes
|
|
27
|
+
|
|
28
|
+
- [`82bd051`](https://github.com/primer/doctocat/commit/82bd051ab35e5939a9ad5a3e89c26e2a63ce5df2) [#376](https://github.com/primer/doctocat/pull/376) Thanks [@vdepizzol](https://github.com/vdepizzol)! - New visual styles for Do/Dont components
|
|
29
|
+
|
|
30
|
+
### Patch Changes
|
|
31
|
+
|
|
32
|
+
- [`0d35f17`](https://github.com/primer/doctocat/commit/0d35f17a34ebfc468e15a23783a55379b8f0e125) [#402](https://github.com/primer/doctocat/pull/402) Thanks [@ichelsea](https://github.com/ichelsea)! - Added underlines to links in markdown documents
|
|
33
|
+
|
|
34
|
+
## 3.2.1
|
|
35
|
+
|
|
36
|
+
### Patch Changes
|
|
37
|
+
|
|
38
|
+
- [`1c0ca36`](https://github.com/primer/doctocat/commit/1c0ca368ed9a61ac79eb6e47ff7208c0d5b038d2) [#361](https://github.com/primer/doctocat/pull/361) Thanks [@colebemis](https://github.com/colebemis)! - Refactor internals to not use deprecated Primer React components
|
|
39
|
+
|
|
40
|
+
* [`ac6de57`](https://github.com/primer/doctocat/commit/ac6de57fdf7629eb74b9246f6ac62f97bca0d4a4) [#334](https://github.com/primer/doctocat/pull/334) Thanks [@siddharthkp](https://github.com/siddharthkp)! - Upgrade from `@primer/components@30.0.0` to `@primer/react@34.5.0`
|
|
41
|
+
|
|
3
42
|
## 3.2.0
|
|
4
43
|
|
|
5
44
|
### Minor Changes
|
|
@@ -175,4 +214,4 @@
|
|
|
175
214
|
|
|
176
215
|
- [`5fb29c9`](https://github.com/primer/doctocat/commit/5fb29c9000dd2a26919f661d969142fa1938d329) [#187](https://github.com/primer/doctocat/pull/187) Thanks [@mvasilkov](https://github.com/mvasilkov)! - Fix typo in an internal import
|
|
177
216
|
|
|
178
|
-
* [`cab38c3`](https://github.com/primer/doctocat/commit/cab38c38eb00a9645991147b28a47a535dcd1d41) [#190](https://github.com/primer/doctocat/pull/190) Thanks [@colebemis](https://github.com/colebemis)! - Update the navigation dropdown icon from a `
|
|
217
|
+
* [`cab38c3`](https://github.com/primer/doctocat/commit/cab38c38eb00a9645991147b28a47a535dcd1d41) [#190](https://github.com/primer/doctocat/pull/190) Thanks [@colebemis](https://github.com/colebemis)! - Update the navigation dropdown icon from a `chevron` to a `caret` to follow our [progressive disclosure guidelines](https://primer.style/design/ui-patterns/progressive-disclosure#progressive-disclosure-ui-patterns)
|
package/babel.config.js
CHANGED
package/gatsby-node.js
CHANGED
|
@@ -30,7 +30,7 @@ exports.createPages = async ({graphql, actions}, themeOptions) => {
|
|
|
30
30
|
}
|
|
31
31
|
`)
|
|
32
32
|
|
|
33
|
-
if (!process.env.GITHUB_TOKEN
|
|
33
|
+
if (!process.env.GITHUB_TOKEN) {
|
|
34
34
|
console.error(`Non-deploy build and no GITHUB_TOKEN environment variable set; skipping GitHub API calls`)
|
|
35
35
|
}
|
|
36
36
|
|
|
@@ -48,7 +48,7 @@ exports.createPages = async ({graphql, actions}, themeOptions) => {
|
|
|
48
48
|
const editUrl = getEditUrl(repo, fileRelativePath, defaultBranch)
|
|
49
49
|
|
|
50
50
|
let contributors = []
|
|
51
|
-
if (process.env.GITHUB_TOKEN
|
|
51
|
+
if (process.env.GITHUB_TOKEN) {
|
|
52
52
|
contributors = await fetchContributors(repo, fileRelativePath, process.env.GITHUB_TOKEN)
|
|
53
53
|
}
|
|
54
54
|
|
package/jest.config.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@primer/gatsby-theme-doctocat",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"scripts": {
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
"eslint-config-prettier": "^8.3.0",
|
|
16
16
|
"eslint-plugin-jsx-a11y": "^6.4.1",
|
|
17
17
|
"eslint-plugin-prettier": "^4.0.0",
|
|
18
|
-
"eslint-plugin-primer-react": "0.
|
|
18
|
+
"eslint-plugin-primer-react": "0.7.4",
|
|
19
19
|
"eslint-plugin-react": "^7.26.1",
|
|
20
|
-
"gatsby": "^2.
|
|
20
|
+
"gatsby": "^2.32.13",
|
|
21
21
|
"prettier": "^2.4.1",
|
|
22
22
|
"react": "^16.13.1",
|
|
23
23
|
"react-dom": "^16.13.1"
|
|
@@ -33,18 +33,18 @@
|
|
|
33
33
|
"@mdx-js/mdx": "^1.0.21",
|
|
34
34
|
"@mdx-js/react": "^1.0.21",
|
|
35
35
|
"@primer/component-metadata": "^0.4.0",
|
|
36
|
-
"@primer/
|
|
37
|
-
"@primer/
|
|
36
|
+
"@primer/octicons-react": "^16.3.1",
|
|
37
|
+
"@primer/react": "^35.2.2",
|
|
38
38
|
"@styled-system/theme-get": "^5.0.12",
|
|
39
|
-
"@testing-library/jest-dom": "^
|
|
39
|
+
"@testing-library/jest-dom": "^5.16.2",
|
|
40
40
|
"@testing-library/react": "^9.1.3",
|
|
41
41
|
"axios": "^0.21.2",
|
|
42
42
|
"babel-jest": "^24.9.0",
|
|
43
43
|
"copy-to-clipboard": "^3.2.0",
|
|
44
|
-
"date-fns": "^2.0
|
|
44
|
+
"date-fns": "^2.28.0",
|
|
45
45
|
"details-element-polyfill": "^2.4.0",
|
|
46
46
|
"downshift": "^3.2.10",
|
|
47
|
-
"find-up": "^
|
|
47
|
+
"find-up": "^6.3.0",
|
|
48
48
|
"framer-motion": "^1.4.2",
|
|
49
49
|
"fuse.js": "^3.4.5",
|
|
50
50
|
"gatsby-plugin-catch-links": "^2.1.2",
|
|
@@ -66,12 +66,12 @@
|
|
|
66
66
|
"pluralize": "^8.0.0",
|
|
67
67
|
"preval.macro": "^3.0.0",
|
|
68
68
|
"prism-react-renderer": "^1.2.0",
|
|
69
|
-
"prismjs": "^1.
|
|
69
|
+
"prismjs": "^1.27.0",
|
|
70
70
|
"react-addons-text-content": "^0.0.4",
|
|
71
71
|
"react-element-to-jsx-string": "^14.0.3",
|
|
72
72
|
"react-focus-on": "^3.3.0",
|
|
73
|
-
"react-frame-component": "^
|
|
74
|
-
"react-helmet": "^
|
|
73
|
+
"react-frame-component": "^5.2.1",
|
|
74
|
+
"react-helmet": "^6.1.0",
|
|
75
75
|
"react-live": "^2.1.2",
|
|
76
76
|
"react-measure": "^2.3.0",
|
|
77
77
|
"read-pkg-up": "^6.0.0",
|
package/setup-tests.js
CHANGED
|
@@ -1 +1,10 @@
|
|
|
1
1
|
import '@testing-library/jest-dom/extend-expect'
|
|
2
|
+
|
|
3
|
+
// JSDOM doesn't mock ResizeObserver
|
|
4
|
+
// Copied from https://github.com/primer/react/blob/3fdae477d8067c5131d316548ce5b08aa1017355/src/utils/test-helpers.tsx
|
|
5
|
+
global.ResizeObserver = jest.fn().mockImplementation(() => {
|
|
6
|
+
return {
|
|
7
|
+
observe: jest.fn(),
|
|
8
|
+
disconnect: jest.fn()
|
|
9
|
+
}
|
|
10
|
+
})
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {Text} from '@primer/
|
|
1
|
+
import {Text} from '@primer/react'
|
|
2
2
|
import React from 'react'
|
|
3
3
|
|
|
4
4
|
function Caption(props) {
|
|
5
|
-
return <Text as="p"
|
|
5
|
+
return <Text as="p" {...props} sx={{mt: 2, mb: 3, fontSize: 1, color: 'gray.5'}} />
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
export default Caption
|
package/src/components/code.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {Box, Text} from '@primer/react'
|
|
2
2
|
import Highlight, {defaultProps} from 'prism-react-renderer'
|
|
3
|
-
import Prism from '../prism'
|
|
4
|
-
import githubTheme from '../github'
|
|
5
3
|
import React from 'react'
|
|
4
|
+
import githubTheme from '../github'
|
|
5
|
+
import Prism from '../prism'
|
|
6
6
|
import ClipboardCopy from './clipboard-copy'
|
|
7
7
|
import LiveCode from './live-code'
|
|
8
8
|
|
|
@@ -15,41 +15,38 @@ function Code({className, children, live, noinline, metastring}) {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
return (
|
|
18
|
-
<
|
|
18
|
+
<Box
|
|
19
19
|
sx={{
|
|
20
20
|
// Make <pre> adjust to the width of the container
|
|
21
21
|
// https://stackoverflow.com/a/14406386
|
|
22
22
|
display: 'table',
|
|
23
23
|
tableLayout: 'fixed',
|
|
24
|
-
width: '100%'
|
|
24
|
+
width: '100%',
|
|
25
|
+
position: 'relative'
|
|
25
26
|
}}
|
|
26
27
|
>
|
|
27
|
-
<
|
|
28
|
+
<Box sx={{top: 0, right: 0, p: 2, position: 'absolute'}}>
|
|
28
29
|
<ClipboardCopy value={code} />
|
|
29
|
-
</
|
|
30
|
+
</Box>
|
|
30
31
|
<Highlight {...defaultProps} Prism={Prism} code={code} language={language} theme={githubTheme}>
|
|
31
32
|
{({className, style, tokens, getLineProps, getTokenProps}) => (
|
|
32
33
|
<Box
|
|
33
34
|
as="pre"
|
|
34
35
|
className={className}
|
|
35
|
-
mt={0}
|
|
36
|
-
mb={3}
|
|
37
|
-
p={3}
|
|
38
|
-
border={0}
|
|
39
36
|
style={{...style, overflow: 'auto'}}
|
|
40
|
-
sx={{borderRadius: 2}}
|
|
37
|
+
sx={{borderRadius: 2, mt: 0, mb: 3, p: 3, border: 0}}
|
|
41
38
|
>
|
|
42
39
|
{tokens.map((line, i) => (
|
|
43
40
|
<div key={i} {...getLineProps({line, key: i})}>
|
|
44
41
|
{line.map((token, key) => (
|
|
45
|
-
<Text key={key}
|
|
42
|
+
<Text key={key} {...getTokenProps({token, key})} sx={{fontFamily: 'mono', fontSize: 1}} />
|
|
46
43
|
))}
|
|
47
44
|
</div>
|
|
48
45
|
))}
|
|
49
46
|
</Box>
|
|
50
47
|
)}
|
|
51
48
|
</Highlight>
|
|
52
|
-
</
|
|
49
|
+
</Box>
|
|
53
50
|
)
|
|
54
51
|
}
|
|
55
52
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {Box} from '@primer/
|
|
1
|
+
import {Box} from '@primer/react'
|
|
2
2
|
import React from 'react'
|
|
3
3
|
|
|
4
4
|
function Container({children}) {
|
|
5
5
|
return (
|
|
6
|
-
<Box id="skip-nav" width
|
|
6
|
+
<Box id="skip-nav" sx={{width: '100%', maxWidth: 960, p: 5, mx: 'auto'}}>
|
|
7
7
|
{children}
|
|
8
8
|
</Box>
|
|
9
9
|
)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {Avatar, Box, Link, Text, Tooltip} from '@primer/
|
|
1
|
+
import {Avatar, Box, Link, Text, Tooltip} from '@primer/react'
|
|
2
2
|
import {format} from 'date-fns'
|
|
3
3
|
import uniqBy from 'lodash.uniqby'
|
|
4
4
|
import pluralize from 'pluralize'
|
|
@@ -12,8 +12,8 @@ function Contributors({contributors}) {
|
|
|
12
12
|
|
|
13
13
|
return (
|
|
14
14
|
<div>
|
|
15
|
-
<Box display
|
|
16
|
-
<Text
|
|
15
|
+
<Box sx={{display: 'flex', alignItems: 'center'}}>
|
|
16
|
+
<Text sx={{mr: 2}}>
|
|
17
17
|
{uniqueContributors.length} {pluralize('contributor', uniqueContributors.length)}
|
|
18
18
|
</Text>
|
|
19
19
|
{uniqueContributors.map(contributor => (
|
|
@@ -30,7 +30,7 @@ function Contributors({contributors}) {
|
|
|
30
30
|
</Box>
|
|
31
31
|
|
|
32
32
|
{latestContributor.latestCommit ? (
|
|
33
|
-
<Text
|
|
33
|
+
<Text sx={{fontSize: 1, color: 'fg.muted', mt: 1}}>
|
|
34
34
|
Last edited by <Link href={`https://github.com/${latestContributor.login}`}>{latestContributor.login}</Link>{' '}
|
|
35
35
|
on{' '}
|
|
36
36
|
<Link href={latestContributor.latestCommit.url}>
|
|
@@ -9,7 +9,7 @@ if (typeof window !== 'undefined') {
|
|
|
9
9
|
import('details-element-polyfill')
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
// TODO: Replace this Details component with the one from @primer/
|
|
12
|
+
// TODO: Replace this Details component with the one from @primer/react when 14.0.0 is released.
|
|
13
13
|
// Reference: https://github.com/primer/components/pull/499
|
|
14
14
|
|
|
15
15
|
const DetailsReset = styled.details`
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import {Box, StyledOcticon, Text} from '@primer/
|
|
2
|
-
import {CheckCircleFillIcon, XCircleFillIcon} from '@primer/octicons-react'
|
|
1
|
+
import {Box, StyledOcticon, Text} from '@primer/react'
|
|
3
2
|
import React from 'react'
|
|
4
3
|
|
|
5
4
|
export function DoDontContainer({stacked, children}) {
|
|
6
5
|
return (
|
|
7
|
-
<Box display
|
|
6
|
+
<Box sx={{display: 'grid', gridTemplateColumns: ['1fr', null, stacked ? '1fr' : '1fr 1fr'], gridGap: 4, mb: 4}}>
|
|
8
7
|
{children}
|
|
9
8
|
</Box>
|
|
10
9
|
)
|
|
@@ -15,24 +14,48 @@ DoDontContainer.defaultProps = {
|
|
|
15
14
|
}
|
|
16
15
|
|
|
17
16
|
export function Do(props) {
|
|
18
|
-
return <DoDontBase {...props} title="Do"
|
|
17
|
+
return <DoDontBase {...props} title="Do" bg="success.fg" borderColor="success.muted" />
|
|
19
18
|
}
|
|
20
19
|
|
|
21
20
|
export function Dont(props) {
|
|
22
|
-
return <DoDontBase {...props} title="Don
|
|
21
|
+
return <DoDontBase {...props} title="Don’t" bg="danger.fg" borderColor="danger.muted" />
|
|
23
22
|
}
|
|
24
23
|
|
|
25
|
-
function DoDontBase({children, title,
|
|
24
|
+
function DoDontBase({children, title, bg, borderColor, indented}) {
|
|
26
25
|
return (
|
|
27
|
-
<Box display
|
|
28
|
-
<Box
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
26
|
+
<Box sx={{display: 'flex', flexDirection: 'column'}}>
|
|
27
|
+
<Box
|
|
28
|
+
sx={{
|
|
29
|
+
display: 'flex',
|
|
30
|
+
alignSelf: 'start',
|
|
31
|
+
flexDirection: 'row',
|
|
32
|
+
alignItems: 'center',
|
|
33
|
+
mb: '2',
|
|
34
|
+
backgroundColor: bg,
|
|
35
|
+
borderRadius: '2',
|
|
36
|
+
color: 'fg.onEmphasis',
|
|
37
|
+
paddingX: '2'
|
|
38
|
+
}}
|
|
39
|
+
>
|
|
40
|
+
<Text sx={{fontWeight: 'bold', fontSize: '1', color: 'fg.onEmphasis'}}>{title}</Text>
|
|
33
41
|
</Box>
|
|
34
|
-
<Box
|
|
35
|
-
{
|
|
42
|
+
<Box sx={{'& *:last-child': {mb: 0}, img: {maxWidth: '100%'}, display: 'flex', flexDirection: 'column'}}>
|
|
43
|
+
{indented ? (
|
|
44
|
+
<Box
|
|
45
|
+
as="blockquote"
|
|
46
|
+
sx={{
|
|
47
|
+
margin: '0',
|
|
48
|
+
borderLeftWidth: '4px',
|
|
49
|
+
borderLeftStyle: 'solid',
|
|
50
|
+
borderLeftColor: borderColor,
|
|
51
|
+
paddingLeft: '3'
|
|
52
|
+
}}
|
|
53
|
+
>
|
|
54
|
+
{children}
|
|
55
|
+
</Box>
|
|
56
|
+
) : (
|
|
57
|
+
children
|
|
58
|
+
)}
|
|
36
59
|
</Box>
|
|
37
60
|
</Box>
|
|
38
61
|
)
|
package/src/components/drawer.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {Box} from '@primer/react'
|
|
2
2
|
import {AnimatePresence, motion} from 'framer-motion'
|
|
3
3
|
import React from 'react'
|
|
4
4
|
import {FocusOn} from 'react-focus-on'
|
|
@@ -16,7 +16,7 @@ function Drawer({isOpen, onDismiss, children}) {
|
|
|
16
16
|
onClick={event => event.target.focus()}
|
|
17
17
|
>
|
|
18
18
|
<FocusOn returnFocus={true} onEscapeKey={() => onDismiss()}>
|
|
19
|
-
<
|
|
19
|
+
<Box
|
|
20
20
|
key="overlay"
|
|
21
21
|
as={motion.div}
|
|
22
22
|
initial={{opacity: 0}}
|
|
@@ -24,10 +24,10 @@ function Drawer({isOpen, onDismiss, children}) {
|
|
|
24
24
|
exit={{opacity: 0}}
|
|
25
25
|
transition={{type: 'tween'}}
|
|
26
26
|
onClick={() => onDismiss()}
|
|
27
|
-
sx={{top: 0, right: 0, bottom: 0, left: 0, bg: 'rgba(0, 0, 0, 0.5)'}}
|
|
27
|
+
sx={{top: 0, right: 0, bottom: 0, left: 0, bg: 'rgba(0, 0, 0, 0.5)', position: 'fixed'}}
|
|
28
28
|
/>
|
|
29
29
|
|
|
30
|
-
<
|
|
30
|
+
<Box
|
|
31
31
|
key="drawer"
|
|
32
32
|
as={motion.div}
|
|
33
33
|
initial={{x: '100%'}}
|
|
@@ -35,10 +35,10 @@ function Drawer({isOpen, onDismiss, children}) {
|
|
|
35
35
|
exit={{x: '100%'}}
|
|
36
36
|
transition={{type: 'tween', duration: 0.2}}
|
|
37
37
|
style={{zIndex: 1}}
|
|
38
|
-
sx={{width: 300, top: 0, right: 0, bottom: 0, bg: 'gray.0'}}
|
|
38
|
+
sx={{width: 300, top: 0, right: 0, bottom: 0, bg: 'gray.0', position: 'fixed'}}
|
|
39
39
|
>
|
|
40
40
|
{children}
|
|
41
|
-
</
|
|
41
|
+
</Box>
|
|
42
42
|
</FocusOn>
|
|
43
43
|
</div>
|
|
44
44
|
) : null}
|
package/src/components/header.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {Box, Button, Link, Sticky, StyledOcticon, Text, ThemeProvider, useTheme} from '@primer/components'
|
|
2
1
|
import {MarkGithubIcon, SearchIcon, ThreeBarsIcon} from '@primer/octicons-react'
|
|
2
|
+
import {Box, Button, Link, StyledOcticon, Text, ThemeProvider, useTheme} from '@primer/react'
|
|
3
3
|
import {Link as GatsbyLink} from 'gatsby'
|
|
4
4
|
import React from 'react'
|
|
5
5
|
import primerNavItems from '../primer-nav.yml'
|
|
@@ -18,16 +18,18 @@ function Header({isSearchEnabled}) {
|
|
|
18
18
|
const siteMetadata = useSiteMetadata()
|
|
19
19
|
return (
|
|
20
20
|
<ThemeProvider colorMode="night" nightScheme="dark_dimmed">
|
|
21
|
-
<
|
|
21
|
+
<Box sx={{position: 'sticky', top: 0, zIndex: 1}}>
|
|
22
22
|
<Box
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
23
|
+
sx={{
|
|
24
|
+
display: 'flex',
|
|
25
|
+
height: HEADER_HEIGHT,
|
|
26
|
+
px: [3, null, null, 4],
|
|
27
|
+
alignItems: 'center',
|
|
28
|
+
justifyContent: 'space-between',
|
|
29
|
+
bg: 'canvas.default'
|
|
30
|
+
}}
|
|
29
31
|
>
|
|
30
|
-
<Box display
|
|
32
|
+
<Box sx={{display: 'flex', alignItems: 'center'}}>
|
|
31
33
|
<Link
|
|
32
34
|
href="https://primer.style"
|
|
33
35
|
sx={{
|
|
@@ -57,7 +59,9 @@ function Header({isSearchEnabled}) {
|
|
|
57
59
|
|
|
58
60
|
{siteMetadata.shortName ? (
|
|
59
61
|
<>
|
|
60
|
-
<Text
|
|
62
|
+
<Text
|
|
63
|
+
sx={{display: ['none', null, null, 'inline-block'], color: 'accent.fg', fontFamily: 'mono', mx: 2}}
|
|
64
|
+
>
|
|
61
65
|
/
|
|
62
66
|
</Text>
|
|
63
67
|
<Link
|
|
@@ -74,16 +78,16 @@ function Header({isSearchEnabled}) {
|
|
|
74
78
|
) : null}
|
|
75
79
|
|
|
76
80
|
{isSearchEnabled ? (
|
|
77
|
-
<Box
|
|
81
|
+
<Box sx={{display: ['none', null, null, 'block'], ml: 4}}>
|
|
78
82
|
<Search />
|
|
79
83
|
</Box>
|
|
80
84
|
) : null}
|
|
81
85
|
</Box>
|
|
82
86
|
<Box>
|
|
83
|
-
<Box
|
|
87
|
+
<Box sx={{display: ['none', null, null, 'block']}}>
|
|
84
88
|
<PrimerNavItems items={primerNavItems} />
|
|
85
89
|
</Box>
|
|
86
|
-
<Box
|
|
90
|
+
<Box sx={{display: ['flex', null, null, 'none']}}>
|
|
87
91
|
{isSearchEnabled ? (
|
|
88
92
|
<>
|
|
89
93
|
<Button
|
|
@@ -113,7 +117,7 @@ function Header({isSearchEnabled}) {
|
|
|
113
117
|
</Box>
|
|
114
118
|
</Box>
|
|
115
119
|
</Box>
|
|
116
|
-
</
|
|
120
|
+
</Box>
|
|
117
121
|
</ThemeProvider>
|
|
118
122
|
)
|
|
119
123
|
}
|
|
@@ -124,11 +128,11 @@ Header.defaultProps = {
|
|
|
124
128
|
|
|
125
129
|
function PrimerNavItems({items}) {
|
|
126
130
|
return (
|
|
127
|
-
<Box display
|
|
131
|
+
<Box sx={{display: 'flex', alignItems: 'center', color: 'fg.default'}}>
|
|
128
132
|
{items.map((item, index) => {
|
|
129
133
|
if (item.children) {
|
|
130
134
|
return (
|
|
131
|
-
<Box
|
|
135
|
+
<Box key={index} sx={{ml: 4}}>
|
|
132
136
|
<NavDropdown title={item.title}>
|
|
133
137
|
{item.children.map(child => (
|
|
134
138
|
<NavDropdownItem key={child.title} href={child.url}>
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {Box
|
|
1
|
+
import {Box} from '@primer/react'
|
|
2
2
|
import React from 'react'
|
|
3
3
|
import Container from './container'
|
|
4
|
-
import PageFooter from './page-footer'
|
|
5
4
|
import Head from './head'
|
|
6
5
|
import Header from './header'
|
|
7
6
|
import Hero from './hero'
|
|
7
|
+
import PageFooter from './page-footer'
|
|
8
8
|
import Sidebar from './sidebar'
|
|
9
9
|
|
|
10
10
|
function HeroLayout({children, pageContext}) {
|
|
@@ -15,14 +15,14 @@ function HeroLayout({children, pageContext}) {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
return (
|
|
18
|
-
<
|
|
18
|
+
<Box sx={{flexDirection: 'column', minHeight: '100vh', display: 'flex'}}>
|
|
19
19
|
<Head />
|
|
20
20
|
<Header />
|
|
21
|
-
<
|
|
22
|
-
<Box
|
|
21
|
+
<Box sx={{flex: '1 1 auto', flexDirection: 'row', display: 'flex'}}>
|
|
22
|
+
<Box sx={{display: ['none', null, null, 'block']}}>
|
|
23
23
|
<Sidebar />
|
|
24
24
|
</Box>
|
|
25
|
-
<Box width
|
|
25
|
+
<Box sx={{width: '100%'}}>
|
|
26
26
|
<Hero />
|
|
27
27
|
<Container>
|
|
28
28
|
{children}
|
|
@@ -32,8 +32,8 @@ function HeroLayout({children, pageContext}) {
|
|
|
32
32
|
/>
|
|
33
33
|
</Container>
|
|
34
34
|
</Box>
|
|
35
|
-
</
|
|
36
|
-
</
|
|
35
|
+
</Box>
|
|
36
|
+
</Box>
|
|
37
37
|
)
|
|
38
38
|
}
|
|
39
39
|
|
package/src/components/hero.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {Box, Heading, Text, ThemeProvider} from '@primer/
|
|
1
|
+
import {Box, Heading, Text, ThemeProvider} from '@primer/react'
|
|
2
2
|
import React from 'react'
|
|
3
3
|
import useSiteMetadata from '../use-site-metadata'
|
|
4
4
|
import Container from './container'
|
|
@@ -8,12 +8,12 @@ function Hero() {
|
|
|
8
8
|
|
|
9
9
|
return (
|
|
10
10
|
<ThemeProvider colorMode="night" nightScheme="dark_dimmed">
|
|
11
|
-
<Box bg
|
|
11
|
+
<Box sx={{bg: 'canvas.default', py: 6}}>
|
|
12
12
|
<Container>
|
|
13
13
|
<Heading as="h1" sx={{color: 'accent.fg', fontSize: 7, m: 0}}>
|
|
14
14
|
{title}
|
|
15
15
|
</Heading>
|
|
16
|
-
<Text as="p"
|
|
16
|
+
<Text as="p" sx={{m: 0, color: 'fg.default', fontSize: 4}}>
|
|
17
17
|
{description}
|
|
18
18
|
</Text>
|
|
19
19
|
</Container>
|
|
@@ -1,11 +1,20 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {Box} from '@primer/react'
|
|
2
2
|
import React from 'react'
|
|
3
3
|
|
|
4
4
|
function ImageContainer({children}) {
|
|
5
5
|
return (
|
|
6
|
-
<
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
<Box
|
|
7
|
+
sx={{
|
|
8
|
+
p: 6,
|
|
9
|
+
bg: 'gray.1',
|
|
10
|
+
borderWidth: '1px',
|
|
11
|
+
borderStyle: 'solid',
|
|
12
|
+
borderColor: 'border.default',
|
|
13
|
+
borderRadius: 2
|
|
14
|
+
}}
|
|
15
|
+
>
|
|
16
|
+
<Box sx={{img: {maxWidth: '100%'}, justifyContent: 'center', display: 'flex'}}>{children}</Box>
|
|
17
|
+
</Box>
|
|
9
18
|
)
|
|
10
19
|
}
|
|
11
20
|
|