@primer/gatsby-theme-doctocat 3.1.0 → 3.2.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/.eslintrc.json +2 -1
- package/CHANGELOG.md +20 -0
- package/babel.config.js +11 -1
- package/gatsby-node.js +1 -1
- package/jest.config.js +2 -1
- package/package.json +3 -3
- package/src/components/caption.js +2 -2
- package/src/components/clipboard-copy.js +1 -1
- package/src/components/code.js +13 -16
- 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 +6 -8
- 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 +40 -35
- package/src/components/live-code.js +27 -13
- package/src/components/live-preview-wrapper.js +2 -2
- package/src/components/mobile-search.js +19 -10
- package/src/components/nav-drawer.js +46 -21
- package/src/components/nav-dropdown.js +11 -9
- package/src/components/nav-items.js +22 -11
- 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 +15 -8
- 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 +3 -3
- package/src/components/text-input.js +2 -2
- package/src/components/wrap-page-element.js +1 -1
- package/src/components/wrap-root-element.js +1 -1
package/.eslintrc.json
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @primer/gatsby-theme-doctocat
|
|
2
2
|
|
|
3
|
+
## 3.2.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`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
|
|
8
|
+
|
|
9
|
+
* [`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`
|
|
10
|
+
|
|
11
|
+
## 3.2.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- [`438eadb`](https://github.com/primer/doctocat/commit/438eadbae21b14c246ca7f6c9f405a1c4a00728a) [#332](https://github.com/primer/doctocat/pull/332) Thanks [@siddharthkp](https://github.com/siddharthkp)! - Support function for `live-code-scope`
|
|
16
|
+
|
|
17
|
+
## 3.1.1
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- [`45e8748`](https://github.com/primer/doctocat/commit/45e8748a547903b8f7091fafb5b13e5c197b0dae) [#324](https://github.com/primer/doctocat/pull/324) Thanks [@rezrah](https://github.com/rezrah)! - Only add pages that have `componentId` and `status` to `components.json`
|
|
22
|
+
|
|
3
23
|
## 3.1.0
|
|
4
24
|
|
|
5
25
|
### Minor Changes
|
package/babel.config.js
CHANGED
package/gatsby-node.js
CHANGED
|
@@ -79,7 +79,7 @@ exports.onPostBuild = async ({graphql}) => {
|
|
|
79
79
|
try {
|
|
80
80
|
const {data} = await graphql(`
|
|
81
81
|
query {
|
|
82
|
-
allSitePage(filter: {context: {frontmatter: {componentId: {ne: null}}}}) {
|
|
82
|
+
allSitePage(filter: {context: {frontmatter: {componentId: {ne: null}, status: {ne: null}}}}) {
|
|
83
83
|
nodes {
|
|
84
84
|
path
|
|
85
85
|
context {
|
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.1
|
|
3
|
+
"version": "3.2.1",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"scripts": {
|
|
@@ -15,7 +15,7 @@
|
|
|
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.3",
|
|
19
19
|
"eslint-plugin-react": "^7.26.1",
|
|
20
20
|
"gatsby": "^2.24.52",
|
|
21
21
|
"prettier": "^2.4.1",
|
|
@@ -33,7 +33,7 @@
|
|
|
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/
|
|
36
|
+
"@primer/react": "^34.5.0",
|
|
37
37
|
"@primer/octicons-react": "^16.0.0",
|
|
38
38
|
"@styled-system/theme-get": "^5.0.12",
|
|
39
39
|
"@testing-library/jest-dom": "^4.1.0",
|
|
@@ -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,55 +1,52 @@
|
|
|
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
|
|
|
9
|
-
function Code({className, children, live, noinline}) {
|
|
9
|
+
function Code({className, children, live, noinline, metastring}) {
|
|
10
10
|
const language = className ? className.replace(/language-/, '') : ''
|
|
11
11
|
const code = children.trim()
|
|
12
12
|
|
|
13
13
|
if (live) {
|
|
14
|
-
return <LiveCode code={code} language={language} noinline={noinline} />
|
|
14
|
+
return <LiveCode code={code} language={language} noinline={noinline} metastring={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,10 @@
|
|
|
1
|
-
import {Box, StyledOcticon, Text} from '@primer/
|
|
1
|
+
import {Box, StyledOcticon, Text} from '@primer/react'
|
|
2
2
|
import {CheckCircleFillIcon, XCircleFillIcon} from '@primer/octicons-react'
|
|
3
3
|
import React from 'react'
|
|
4
4
|
|
|
5
5
|
export function DoDontContainer({stacked, children}) {
|
|
6
6
|
return (
|
|
7
|
-
<Box display
|
|
7
|
+
<Box sx={{display: 'grid', gridTemplateColumns: ['1fr', null, stacked ? '1fr' : '1fr 1fr'], gridGap: 4, mb: 4}}>
|
|
8
8
|
{children}
|
|
9
9
|
</Box>
|
|
10
10
|
)
|
|
@@ -24,14 +24,12 @@ export function Dont(props) {
|
|
|
24
24
|
|
|
25
25
|
function DoDontBase({children, title, icon: Icon, iconBg}) {
|
|
26
26
|
return (
|
|
27
|
-
<Box display
|
|
28
|
-
<Box display
|
|
27
|
+
<Box sx={{display: 'flex', flexDirection: 'column'}}>
|
|
28
|
+
<Box sx={{display: 'flex', alignSelf: 'start', flexDirection: 'row', alignItems: 'center', mb: '2'}}>
|
|
29
29
|
<StyledOcticon icon={Icon} sx={{color: iconBg}} />
|
|
30
|
-
<Text fontWeight
|
|
31
|
-
{title}
|
|
32
|
-
</Text>
|
|
30
|
+
<Text sx={{fontWeight: 'bold', color: 'fg.default', ml: 2}}>{title}</Text>
|
|
33
31
|
</Box>
|
|
34
|
-
<Box
|
|
32
|
+
<Box sx={{'& *:last-child': {mb: 0}, img: {maxWidth: '100%'}, display: 'flex', flexDirection: 'column'}}>
|
|
35
33
|
{children}
|
|
36
34
|
</Box>
|
|
37
35
|
</Box>
|
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
|
|
package/src/components/layout.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import componentMetadata from '@primer/component-metadata'
|
|
2
|
-
import {
|
|
2
|
+
import {Box, Heading, Text} from '@primer/react'
|
|
3
3
|
import React from 'react'
|
|
4
4
|
import Head from './head'
|
|
5
5
|
import Header, {HEADER_HEIGHT} from './header'
|
|
@@ -26,25 +26,25 @@ function Layout({children, pageContext}) {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
return (
|
|
29
|
-
<
|
|
29
|
+
<Box sx={{flexDirection: 'column', minHeight: '100vh', display: 'flex'}}>
|
|
30
30
|
<Head title={title} description={description} />
|
|
31
31
|
<Header />
|
|
32
|
-
<
|
|
33
|
-
<Box
|
|
32
|
+
<Box css={{zIndex: 0}} sx={{flex: '1 1 auto', flexDirection: 'row', display: 'flex'}}>
|
|
33
|
+
<Box sx={{display: ['none', null, null, 'block']}}>
|
|
34
34
|
<Sidebar />
|
|
35
35
|
</Box>
|
|
36
36
|
<Box
|
|
37
37
|
id="skip-nav"
|
|
38
|
-
display="flex"
|
|
39
|
-
width="100%"
|
|
40
|
-
p={[4, 5, 6, 7]}
|
|
41
38
|
sx={{
|
|
42
39
|
justifyContent: 'center',
|
|
43
|
-
flexDirection: 'row-reverse'
|
|
40
|
+
flexDirection: 'row-reverse',
|
|
41
|
+
display: 'flex',
|
|
42
|
+
width: '100%',
|
|
43
|
+
p: [4, 5, 6, 7]
|
|
44
44
|
}}
|
|
45
45
|
>
|
|
46
46
|
{pageContext.tableOfContents.items ? (
|
|
47
|
-
<
|
|
47
|
+
<Box
|
|
48
48
|
sx={{
|
|
49
49
|
width: 220,
|
|
50
50
|
flex: '0 0 auto',
|
|
@@ -56,53 +56,58 @@ function Layout({children, pageContext}) {
|
|
|
56
56
|
}}
|
|
57
57
|
css={{gridArea: 'table-of-contents', overflow: 'auto'}}
|
|
58
58
|
>
|
|
59
|
-
<Text display
|
|
60
|
-
On this page
|
|
61
|
-
</Text>
|
|
59
|
+
<Text sx={{display: 'inline-block', fontWeight: 'bold', mb: 1}}>On this page</Text>
|
|
62
60
|
<TableOfContents items={pageContext.tableOfContents.items} />
|
|
63
|
-
</
|
|
61
|
+
</Box>
|
|
64
62
|
) : null}
|
|
65
|
-
<Box width
|
|
66
|
-
<Box
|
|
67
|
-
<
|
|
63
|
+
<Box sx={{width: '100%', maxWidth: '960px'}}>
|
|
64
|
+
<Box sx={{mb: 4}}>
|
|
65
|
+
<Box sx={{alignItems: 'center', display: 'flex'}}>
|
|
68
66
|
<Heading as="h1" sx={{mr: 2}}>
|
|
69
67
|
{title}
|
|
70
68
|
</Heading>{' '}
|
|
71
69
|
{status ? <StatusLabel status={status} /> : null}
|
|
72
|
-
</
|
|
73
|
-
{description ?
|
|
74
|
-
<Box pb={2} sx={{fontSize: 3}}>
|
|
75
|
-
{description}
|
|
76
|
-
</Box>
|
|
77
|
-
) : null}
|
|
70
|
+
</Box>
|
|
71
|
+
{description ? <Box sx={{fontSize: 3, pb: 2}}>{description}</Box> : null}
|
|
78
72
|
{source || storybook ? (
|
|
79
|
-
<
|
|
73
|
+
<Box
|
|
80
74
|
sx={{
|
|
81
75
|
py: 2,
|
|
82
76
|
gridGap: [1, null, 3],
|
|
83
77
|
gridAutoFlow: ['row', null, 'column'],
|
|
84
78
|
gridAutoColumns: 'max-content',
|
|
85
|
-
gridAutoRows: 'max-content'
|
|
79
|
+
gridAutoRows: 'max-content',
|
|
80
|
+
display: 'grid'
|
|
86
81
|
}}
|
|
87
82
|
>
|
|
88
83
|
{source ? <SourceLink href={source} /> : null}
|
|
89
84
|
{storybook ? <StorybookLink href={storybook} /> : null}
|
|
90
|
-
</
|
|
85
|
+
</Box>
|
|
91
86
|
) : null}
|
|
92
87
|
</Box>
|
|
93
88
|
{pageContext.tableOfContents.items ? (
|
|
94
|
-
<
|
|
95
|
-
sx={{
|
|
89
|
+
<Box
|
|
90
|
+
sx={{
|
|
91
|
+
display: ['block', null, 'none'],
|
|
92
|
+
mb: 5,
|
|
93
|
+
borderColor: 'border.muted',
|
|
94
|
+
bg: 'canvas.subtle',
|
|
95
|
+
borderWidth: '1px',
|
|
96
|
+
borderStyle: 'solid',
|
|
97
|
+
borderRadius: 2
|
|
98
|
+
}}
|
|
96
99
|
>
|
|
97
|
-
<Box
|
|
98
|
-
<
|
|
99
|
-
|
|
100
|
-
|
|
100
|
+
<Box sx={{p: 3}}>
|
|
101
|
+
<Box
|
|
102
|
+
sx={{flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', display: 'flex'}}
|
|
103
|
+
>
|
|
104
|
+
<Text sx={{fontWeight: 'bold'}}>On this page</Text>
|
|
105
|
+
</Box>
|
|
101
106
|
</Box>
|
|
102
|
-
<Box
|
|
107
|
+
<Box sx={{p: 3, borderTop: '1px solid', borderColor: 'border.muted'}}>
|
|
103
108
|
<TableOfContents items={pageContext.tableOfContents.items} />
|
|
104
109
|
</Box>
|
|
105
|
-
</
|
|
110
|
+
</Box>
|
|
106
111
|
) : null}
|
|
107
112
|
{children}
|
|
108
113
|
<PageFooter
|
|
@@ -111,8 +116,8 @@ function Layout({children, pageContext}) {
|
|
|
111
116
|
/>
|
|
112
117
|
</Box>
|
|
113
118
|
</Box>
|
|
114
|
-
</
|
|
115
|
-
</
|
|
119
|
+
</Box>
|
|
120
|
+
</Box>
|
|
116
121
|
)
|
|
117
122
|
}
|
|
118
123
|
|