@primer/gatsby-theme-doctocat 4.1.0 → 4.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/CHANGELOG.md +24 -0
- package/gatsby-node.js +3 -1
- package/package.json +2 -3
- package/src/components/figma-link.js +17 -13
- package/src/components/frame.js +18 -14
- package/src/components/horizontal-rule.js +2 -2
- package/src/components/layout.js +88 -24
- package/src/components/lookbook-link.js +10 -20
- package/src/components/rails-link.js +36 -0
- package/src/components/react-link.js +36 -0
- package/src/components/sidebar.js +1 -1
- package/src/components/source-link.js +9 -5
- package/src/components/status-label.js +31 -3
- package/src/components/storybook-link.js +10 -20
- package/src/components/superscript.js +25 -0
- package/src/components/table.js +30 -8
- package/src/components/wrap-page-element.js +15 -0
- package/src/components/wrap-root-element.js +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# @primer/gatsby-theme-doctocat
|
|
2
2
|
|
|
3
|
+
## 4.2.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`6c4da9e`](https://github.com/primer/doctocat/commit/6c4da9e5787862460972b2af75a27e5909093a05) [#498](https://github.com/primer/doctocat/pull/498) Thanks [@colebemis](https://github.com/colebemis)! - Fix live examples disappearing on hard reload
|
|
8
|
+
|
|
9
|
+
## 4.2.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [`2aed832`](https://github.com/primer/doctocat/commit/2aed832beb012ec20767a9226c03aa1bcb12af5d) [#481](https://github.com/primer/doctocat/pull/481) Thanks [@josepmartins](https://github.com/josepmartins)! - - Add accessibility reviewed Label in the Layout
|
|
14
|
+
- Add Rails + React links to cover design guidelines needs
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- [`9b62706`](https://github.com/primer/doctocat/commit/9b62706dddf3fea68a44f29d3763198ba3d57dd6) [#485](https://github.com/primer/doctocat/pull/485) Thanks [@josepmartins](https://github.com/josepmartins)! - - Ad superscript component
|
|
19
|
+
- Basic style for footnotes section
|
|
20
|
+
- Table styles
|
|
21
|
+
- Add sizes prop to StatusLabel component
|
|
22
|
+
|
|
23
|
+
* [`61c5587`](https://github.com/primer/doctocat/commit/61c55874443fdb02873d6c47b1c931b4d3362231) [#460](https://github.com/primer/doctocat/pull/460) Thanks [@josepmartins](https://github.com/josepmartins)! - Adjust Sidebar to use fixed `width`
|
|
24
|
+
|
|
25
|
+
- [`9d39774`](https://github.com/primer/doctocat/commit/9d397746fdeb3a6d3131304183400e1e1f4139c5) [#468](https://github.com/primer/doctocat/pull/468) Thanks [@josepmartins](https://github.com/josepmartins)! - - Add a11yReviewed frontmatter data to onPostBuild static files
|
|
26
|
+
|
|
3
27
|
## 4.1.0
|
|
4
28
|
|
|
5
29
|
### Minor Changes
|
package/gatsby-node.js
CHANGED
|
@@ -86,6 +86,7 @@ exports.onPostBuild = async ({graphql}) => {
|
|
|
86
86
|
frontmatter {
|
|
87
87
|
componentId
|
|
88
88
|
status
|
|
89
|
+
a11yReviewed
|
|
89
90
|
}
|
|
90
91
|
}
|
|
91
92
|
}
|
|
@@ -97,7 +98,8 @@ exports.onPostBuild = async ({graphql}) => {
|
|
|
97
98
|
return {
|
|
98
99
|
id: node.context.frontmatter.componentId,
|
|
99
100
|
path: node.path,
|
|
100
|
-
status: node.context.frontmatter.status.toLowerCase()
|
|
101
|
+
status: node.context.frontmatter.status.toLowerCase(),
|
|
102
|
+
a11yReviewed: node.context.frontmatter.a11yReviewed || false
|
|
101
103
|
}
|
|
102
104
|
})
|
|
103
105
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@primer/gatsby-theme-doctocat",
|
|
3
|
-
"version": "4.1
|
|
3
|
+
"version": "4.2.1",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"scripts": {
|
|
@@ -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/octicons-react": "^
|
|
36
|
+
"@primer/octicons-react": "^17.5.0",
|
|
37
37
|
"@primer/react": "^35.2.2",
|
|
38
38
|
"@styled-system/theme-get": "^5.0.12",
|
|
39
39
|
"@testing-library/jest-dom": "^5.16.2",
|
|
@@ -70,7 +70,6 @@
|
|
|
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": "^5.2.1",
|
|
74
73
|
"react-helmet": "^6.1.0",
|
|
75
74
|
"react-live": "^2.1.2",
|
|
76
75
|
"react-measure": "^2.3.0",
|
|
@@ -1,30 +1,34 @@
|
|
|
1
|
-
import {Link, Text} from '@primer/react'
|
|
1
|
+
import {Link, Text, Box} from '@primer/react'
|
|
2
2
|
import React from 'react'
|
|
3
3
|
|
|
4
4
|
function SourceLink({href}) {
|
|
5
5
|
return (
|
|
6
|
-
<
|
|
7
|
-
<
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
<li>
|
|
7
|
+
<Link href={href} target="_blank">
|
|
8
|
+
<Box sx={{display: 'flex', gap: 1, alignItems: 'center'}}>
|
|
9
|
+
<FigmaLogo />
|
|
10
|
+
<Text>Figma</Text>
|
|
11
|
+
</Box>
|
|
12
|
+
</Link>
|
|
13
|
+
</li>
|
|
10
14
|
)
|
|
11
15
|
}
|
|
12
16
|
|
|
13
17
|
function FigmaLogo() {
|
|
14
18
|
return (
|
|
15
19
|
<svg
|
|
20
|
+
viewBox="0 0 16 16"
|
|
21
|
+
aria-hidden="true"
|
|
16
22
|
width={16}
|
|
17
23
|
height={16}
|
|
18
|
-
|
|
19
|
-
style={{verticalAlign: 'text-bottom'}}
|
|
20
|
-
fill="none"
|
|
24
|
+
fill="currentColor"
|
|
21
25
|
xmlns="http://www.w3.org/2000/svg"
|
|
22
|
-
viewBox="0 0 172 247"
|
|
23
26
|
>
|
|
24
|
-
<
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
<path
|
|
28
|
+
fillRule="evenodd"
|
|
29
|
+
clipRule="evenodd"
|
|
30
|
+
d="M5.417 0A3.167 3.167 0 0 0 3.37 5.583 3.16 3.16 0 0 0 2.25 8a3.16 3.16 0 0 0 1.12 2.417 3.167 3.167 0 1 0 5.213 2.417V10.687a3.165 3.165 0 0 0 3.87-4.964A3.167 3.167 0 0 0 10.582 0H5.417Zm4.727 6.333h.21a1.665 1.665 0 1 1-.21 0Zm.25-1.5h.19a1.667 1.667 0 1 0 0-3.333H5.416a1.667 1.667 0 1 0 0 3.333h4.687a3.226 3.226 0 0 1 .29 0ZM3.75 8c0-.92.746-1.667 1.667-1.667h1.666v3.334H5.417C4.497 9.667 3.75 8.92 3.75 8Zm1.667 3.167a1.667 1.667 0 1 0 1.666 1.667v-1.667H5.417Z"
|
|
31
|
+
/>
|
|
28
32
|
</svg>
|
|
29
33
|
)
|
|
30
34
|
}
|
package/src/components/frame.js
CHANGED
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import
|
|
2
|
+
import ReactDOM from 'react-dom'
|
|
3
3
|
import {StyleSheetManager} from 'styled-components'
|
|
4
4
|
import Measure from 'react-measure'
|
|
5
5
|
|
|
6
6
|
function Frame({children}) {
|
|
7
7
|
const [height, setHeight] = React.useState('auto')
|
|
8
|
+
const [iframeRef, setIframeRef] = React.useState(null)
|
|
9
|
+
const contentDocument = iframeRef ? iframeRef.contentWindow.document : null
|
|
10
|
+
|
|
8
11
|
return (
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
// eslint-disable-next-line jsx-a11y/iframe-has-title
|
|
13
|
+
<iframe ref={setIframeRef} style={{width: '100%', border: 0, borderRadius: 6, height}}>
|
|
14
|
+
{
|
|
15
|
+
// By default, styled-components injects styles in the head of the page.
|
|
16
|
+
// However, styles from the page's head don't apply inside iframes.
|
|
17
|
+
// We're using StyleSheetManager to make styled-components inject styles
|
|
18
|
+
// into the head of the iframe instead.
|
|
19
|
+
contentDocument !== null &&
|
|
20
|
+
ReactDOM.createPortal(
|
|
21
|
+
<StyleSheetManager target={contentDocument.head}>
|
|
18
22
|
<Measure
|
|
19
23
|
// iframes don't adjust to the height of their content by default.
|
|
20
24
|
// We're using Measure to calculate the size of the content
|
|
@@ -24,11 +28,11 @@ function Frame({children}) {
|
|
|
24
28
|
>
|
|
25
29
|
{({measureRef}) => <div ref={measureRef}>{children}</div>}
|
|
26
30
|
</Measure>
|
|
27
|
-
</StyleSheetManager
|
|
31
|
+
</StyleSheetManager>,
|
|
32
|
+
contentDocument.body
|
|
28
33
|
)
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
</FrameComponent>
|
|
34
|
+
}
|
|
35
|
+
</iframe>
|
|
32
36
|
)
|
|
33
37
|
}
|
|
34
38
|
|
|
@@ -2,10 +2,10 @@ import styled from 'styled-components'
|
|
|
2
2
|
import themeGet from '@styled-system/theme-get'
|
|
3
3
|
|
|
4
4
|
const HorizontalRule = styled.hr`
|
|
5
|
-
height: ${themeGet('
|
|
5
|
+
height: ${themeGet('borderWidths.1')};
|
|
6
6
|
padding: 0;
|
|
7
7
|
margin: ${themeGet('space.4')} 0;
|
|
8
|
-
background-color: ${themeGet('colors.
|
|
8
|
+
background-color: ${themeGet('colors.border.default')};
|
|
9
9
|
border: 0;
|
|
10
10
|
`
|
|
11
11
|
|
package/src/components/layout.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import componentMetadata from '@primer/component-metadata'
|
|
2
|
-
import {Box, Heading, Text} from '@primer/react'
|
|
2
|
+
import {Box, Heading, Text, Label, StyledOcticon} from '@primer/react'
|
|
3
|
+
import {AccessibilityInsetIcon} from '@primer/octicons-react'
|
|
3
4
|
import React from 'react'
|
|
4
5
|
import Head from './head'
|
|
5
6
|
import Header, {HEADER_HEIGHT} from './header'
|
|
6
7
|
import PageFooter from './page-footer'
|
|
7
8
|
import Sidebar from './sidebar'
|
|
8
9
|
import SourceLink from './source-link'
|
|
10
|
+
import RailsLink from './rails-link'
|
|
11
|
+
import ReactLink from './react-link'
|
|
9
12
|
import StatusLabel from './status-label'
|
|
10
13
|
import LookbookLink from './lookbook-link'
|
|
11
14
|
import StorybookLink from './storybook-link'
|
|
@@ -13,8 +16,20 @@ import FigmaLink from './figma-link'
|
|
|
13
16
|
import TableOfContents from './table-of-contents'
|
|
14
17
|
|
|
15
18
|
function Layout({children, pageContext}) {
|
|
16
|
-
let {
|
|
17
|
-
|
|
19
|
+
let {
|
|
20
|
+
title,
|
|
21
|
+
description,
|
|
22
|
+
figma,
|
|
23
|
+
react,
|
|
24
|
+
status,
|
|
25
|
+
a11yReviewed,
|
|
26
|
+
source,
|
|
27
|
+
rails,
|
|
28
|
+
storybook,
|
|
29
|
+
lookbook,
|
|
30
|
+
additionalContributors,
|
|
31
|
+
componentId
|
|
32
|
+
} = pageContext.frontmatter
|
|
18
33
|
|
|
19
34
|
if (!additionalContributors) {
|
|
20
35
|
additionalContributors = []
|
|
@@ -66,31 +81,80 @@ function Layout({children, pageContext}) {
|
|
|
66
81
|
</Box>
|
|
67
82
|
) : null}
|
|
68
83
|
<Box sx={{width: '100%', maxWidth: '960px'}}>
|
|
69
|
-
<Box sx={{mb:
|
|
84
|
+
<Box sx={{mb: 7}}>
|
|
70
85
|
<Box sx={{alignItems: 'center', display: 'flex'}}>
|
|
71
|
-
<Heading as="h1" sx={{
|
|
86
|
+
<Heading as="h1" sx={{mb: 2}}>
|
|
72
87
|
{title}
|
|
73
88
|
</Heading>{' '}
|
|
74
|
-
{status ? <StatusLabel status={status} /> : null}
|
|
75
89
|
</Box>
|
|
76
|
-
{description ? <Box sx={{fontSize: 3,
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
90
|
+
{description ? <Box sx={{fontSize: 3, mb: 3}}>{description}</Box> : null}
|
|
91
|
+
<Box
|
|
92
|
+
sx={{
|
|
93
|
+
display: 'flex',
|
|
94
|
+
flexWrap: 'wrap',
|
|
95
|
+
columnGap: 3,
|
|
96
|
+
rowGap: 3,
|
|
97
|
+
alignItems: 'center',
|
|
98
|
+
fontSize: 1
|
|
99
|
+
}}
|
|
100
|
+
>
|
|
101
|
+
{status ? (
|
|
102
|
+
<Box as={'ul'} sx={{display: 'flex', gap: 1, alignItems: 'center', m: 0, p: 0, paddingInline: 0}}>
|
|
103
|
+
<StatusLabel size="large" status={status} />
|
|
104
|
+
{a11yReviewed ? (
|
|
105
|
+
<Label
|
|
106
|
+
as={'li'}
|
|
107
|
+
size="large"
|
|
108
|
+
sx={{
|
|
109
|
+
display: 'flex',
|
|
110
|
+
alignItems: 'center',
|
|
111
|
+
gap: 1,
|
|
112
|
+
backgroundColor: 'done.subtle',
|
|
113
|
+
fontWeight: 'normal',
|
|
114
|
+
borderColor: 'transparent'
|
|
115
|
+
}}
|
|
116
|
+
>
|
|
117
|
+
<StyledOcticon icon={AccessibilityInsetIcon} sx={{fill: 'done.fg'}} />
|
|
118
|
+
Reviewed by accessibility team
|
|
119
|
+
</Label>
|
|
120
|
+
) : (
|
|
121
|
+
<Label
|
|
122
|
+
size="large"
|
|
123
|
+
as={'li'}
|
|
124
|
+
sx={{
|
|
125
|
+
backgroundColor: 'neutral.subtle',
|
|
126
|
+
fontWeight: 'normal',
|
|
127
|
+
borderColor: 'transparent'
|
|
128
|
+
}}
|
|
129
|
+
>
|
|
130
|
+
Review pending by accessibility team
|
|
131
|
+
</Label>
|
|
132
|
+
)}
|
|
133
|
+
</Box>
|
|
134
|
+
) : null}
|
|
135
|
+
{source || storybook || lookbook || figma || rails || react ? (
|
|
136
|
+
<Box
|
|
137
|
+
as={'ul'}
|
|
138
|
+
sx={{
|
|
139
|
+
display: 'flex',
|
|
140
|
+
flexWrap: 'wrap',
|
|
141
|
+
gap: 3,
|
|
142
|
+
alignItems: 'center',
|
|
143
|
+
m: 0,
|
|
144
|
+
p: 0,
|
|
145
|
+
paddingInline: 0,
|
|
146
|
+
listStyle: 'none'
|
|
147
|
+
}}
|
|
148
|
+
>
|
|
149
|
+
{source ? <SourceLink href={source} /> : null}
|
|
150
|
+
{lookbook ? <LookbookLink href={lookbook} /> : null}
|
|
151
|
+
{storybook ? <StorybookLink href={storybook} /> : null}
|
|
152
|
+
{figma ? <FigmaLink href={figma} /> : null}
|
|
153
|
+
{react ? <ReactLink href={react} /> : null}
|
|
154
|
+
{rails ? <RailsLink href={rails} /> : null}
|
|
155
|
+
</Box>
|
|
156
|
+
) : null}
|
|
157
|
+
</Box>
|
|
94
158
|
</Box>
|
|
95
159
|
{pageContext.tableOfContents.items ? (
|
|
96
160
|
<Box
|
|
@@ -1,27 +1,17 @@
|
|
|
1
|
-
import {Link, Text} from '@primer/react'
|
|
1
|
+
import {Link, Text, Box} from '@primer/react'
|
|
2
|
+
import {BookIcon} from '@primer/octicons-react'
|
|
2
3
|
import React from 'react'
|
|
3
4
|
|
|
4
5
|
function SourceLink({href}) {
|
|
5
6
|
return (
|
|
6
|
-
<
|
|
7
|
-
<
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return (
|
|
15
|
-
<svg
|
|
16
|
-
aria-hidden="true"
|
|
17
|
-
viewBox="0 0 24 24"
|
|
18
|
-
width={16}
|
|
19
|
-
height={16}
|
|
20
|
-
fill="currentColor"
|
|
21
|
-
style={{verticalAlign: 'text-bottom'}}
|
|
22
|
-
>
|
|
23
|
-
<path d="M12.3701 0C12.1793 0 12.0588 0.205201 12.1518 0.371843L17.7026 10.3173C17.766 10.4308 17.766 10.5692 17.7026 10.6827L12.1518 20.6282C12.0588 20.7948 12.1793 21 12.3701 21H17.974C18.1099 21 18.2352 20.9265 18.3014 20.8078L23.9524 10.6827C24.0158 10.5692 24.0158 10.4308 23.9524 10.3172L18.3014 0.192237C18.2352 0.07355 18.1099 0 17.974 0H12.3701ZM11.8433 10.3173C11.9067 10.4308 11.9067 10.5692 11.8433 10.6827L6.16371 20.8589C6.06834 21.0298 5.8225 21.0298 5.72712 20.8589L0.04755 10.6827C-0.0158499 10.5692 -0.01585 10.4308 0.0475497 10.3173L5.72712 0.141121C5.8225 -0.029757 6.06834 -0.0297573 6.16371 0.14112L11.8433 10.3173Z" />
|
|
24
|
-
</svg>
|
|
7
|
+
<li>
|
|
8
|
+
<Link href={href} target="_blank">
|
|
9
|
+
<Box sx={{display: 'flex', gap: 1, alignItems: 'center'}}>
|
|
10
|
+
<BookIcon />
|
|
11
|
+
<Text>Lookbook</Text>
|
|
12
|
+
</Box>
|
|
13
|
+
</Link>
|
|
14
|
+
</li>
|
|
25
15
|
)
|
|
26
16
|
}
|
|
27
17
|
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import {Link, Text, Box} from '@primer/react'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
|
|
4
|
+
function SourceLink({href}) {
|
|
5
|
+
return (
|
|
6
|
+
<li>
|
|
7
|
+
<Link href={href} target="_blank">
|
|
8
|
+
<Box sx={{display: 'flex', gap: 1, alignItems: 'center'}}>
|
|
9
|
+
<RailsLogo />
|
|
10
|
+
<Text>Rails</Text>
|
|
11
|
+
</Box>
|
|
12
|
+
</Link>
|
|
13
|
+
</li>
|
|
14
|
+
)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function RailsLogo() {
|
|
18
|
+
return (
|
|
19
|
+
<svg
|
|
20
|
+
viewBox="0 0 16 16"
|
|
21
|
+
aria-hidden="true"
|
|
22
|
+
width={16}
|
|
23
|
+
height={16}
|
|
24
|
+
fill="currentColor"
|
|
25
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
26
|
+
>
|
|
27
|
+
<path
|
|
28
|
+
fillRule="evenodd"
|
|
29
|
+
clipRule="evenodd"
|
|
30
|
+
d="M3.92 1a1 1 0 0 0-.764.355L.236 4.812a1 1 0 0 0-.012 1.275l6.975 8.596a1 1 0 0 0 1.553 0l.972-1.197h.002l.002-.005 6-7.394a1 1 0 0 0-.013-1.275l-2.92-3.457A1 1 0 0 0 12.03 1H3.92Zm6.7 9 3.044-3.75h-2.082L10.62 10Zm.966-5.25h2.113l-1.9-2.25h-.776l.563 2.25ZM9.476 2.5l.563 2.25H5.961l.562-2.25h2.954Zm.557 3.75-1.677 6.54-.38.47-.31-.381-1.7-6.629h4.067Zm-7.781-1.5 1.9-2.25h.825l-.562 2.25H2.252Zm.035 1.5h2.131l.985 3.84-3.116-3.84Z"
|
|
31
|
+
/>
|
|
32
|
+
</svg>
|
|
33
|
+
)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export default SourceLink
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import {Link, Text, Box} from '@primer/react'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
|
|
4
|
+
function SourceLink({href}) {
|
|
5
|
+
return (
|
|
6
|
+
<li>
|
|
7
|
+
<Link href={href} target="_blank">
|
|
8
|
+
<Box sx={{display: 'flex', gap: 1, alignItems: 'center'}}>
|
|
9
|
+
<ReactLogo />
|
|
10
|
+
<Text>React</Text>
|
|
11
|
+
</Box>
|
|
12
|
+
</Link>
|
|
13
|
+
</li>
|
|
14
|
+
)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function ReactLogo() {
|
|
18
|
+
return (
|
|
19
|
+
<svg
|
|
20
|
+
viewBox="0 0 16 16"
|
|
21
|
+
aria-hidden="true"
|
|
22
|
+
width={16}
|
|
23
|
+
height={16}
|
|
24
|
+
fill="currentColor"
|
|
25
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
26
|
+
>
|
|
27
|
+
<path
|
|
28
|
+
fillRule="evenodd"
|
|
29
|
+
clipRule="evenodd"
|
|
30
|
+
d="M11.129 2.533a13 13 0 0 0-1.84 1.035c.566.467 1.13.98 1.683 1.532a23.93 23.93 0 0 1 1.533 1.683 13 13 0 0 0 1.034-1.84c.335-.742.504-1.372.53-1.856.026-.485-.091-.735-.22-.864-.128-.128-.379-.246-.863-.22-.485.027-1.114.196-1.857.53Zm-.616-1.368c-.785.354-1.624.842-2.477 1.444A15.152 15.152 0 0 0 5.56 1.166C4.72.787 3.901.546 3.167.506c-.733-.04-1.47.12-2.006.657-.536.536-.696 1.273-.656 2.006.04.733.281 1.55.66 2.39.353.786.84 1.624 1.443 2.478a15.15 15.15 0 0 0-1.442 2.475c-.378.84-.62 1.657-.66 2.39-.04.734.12 1.47.657 2.007.536.536 1.273.696 2.006.656.733-.04 1.55-.281 2.39-.66a15.15 15.15 0 0 0 2.476-1.441c.853.601 1.69 1.089 2.476 1.442.84.378 1.657.62 2.39.66.734.04 1.47-.121 2.007-.657.536-.536.696-1.273.656-2.006-.04-.734-.281-1.551-.66-2.391a15.149 15.149 0 0 0-1.441-2.475 15.15 15.15 0 0 0 1.443-2.478c.378-.84.62-1.657.66-2.39.04-.734-.121-1.47-.657-2.007-.536-.536-1.273-.696-2.006-.656-.733.04-1.55.281-2.391.66Zm-7.98 3.78c.259.574.607 1.195 1.035 1.838.467-.566.98-1.131 1.533-1.684a23.915 23.915 0 0 1 1.682-1.531 12.995 12.995 0 0 0-1.84-1.035c-.742-.334-1.372-.503-1.856-.53-.485-.026-.735.092-.864.22-.128.129-.246.38-.22.864.027.484.196 1.114.53 1.857ZM6.161 6.16a22.144 22.144 0 0 0-1.678 1.877A22.14 22.14 0 0 0 6.16 9.91a22.155 22.155 0 0 0 1.876 1.678 22.137 22.137 0 0 0 1.877-1.678c.62-.62 1.181-1.251 1.676-1.874A22.137 22.137 0 0 0 9.911 6.16a22.142 22.142 0 0 0-1.875-1.677A22.144 22.144 0 0 0 6.161 6.16Zm-3.626 4.967c.258-.574.605-1.194 1.033-1.837.467.566.98 1.13 1.531 1.682a23.922 23.922 0 0 0 1.684 1.532c-.643.428-1.263.775-1.838 1.034-.743.334-1.373.503-1.857.53-.484.026-.735-.091-.864-.22-.128-.128-.245-.38-.22-.864.027-.484.196-1.114.53-1.857Zm8.592 2.411a13 13 0 0 1-1.837-1.034c.566-.467 1.13-.98 1.683-1.532a23.903 23.903 0 0 0 1.531-1.682c.428.643.775 1.263 1.034 1.837.334.743.503 1.373.53 1.857.026.485-.091.736-.22.864-.128.129-.38.246-.864.22-.484-.027-1.114-.195-1.857-.53ZM8.034 8.782a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Z"
|
|
31
|
+
/>
|
|
32
|
+
</svg>
|
|
33
|
+
)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export default SourceLink
|
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
import {Link, Text} from '@primer/react'
|
|
1
|
+
import {Link, Text, Box} from '@primer/react'
|
|
2
2
|
import {MarkGithubIcon} from '@primer/octicons-react'
|
|
3
3
|
import React from 'react'
|
|
4
4
|
|
|
5
5
|
function SourceLink({href}) {
|
|
6
6
|
return (
|
|
7
|
-
<
|
|
8
|
-
<
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
<li>
|
|
8
|
+
<Link href={href} target="_blank">
|
|
9
|
+
<Box sx={{display: 'flex', gap: 1, alignItems: 'center'}}>
|
|
10
|
+
<MarkGithubIcon />
|
|
11
|
+
<Text>Source</Text>
|
|
12
|
+
</Box>
|
|
13
|
+
</Link>
|
|
14
|
+
</li>
|
|
11
15
|
)
|
|
12
16
|
}
|
|
13
17
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {Label} from '@primer/react'
|
|
1
|
+
import {Label, Box} from '@primer/react'
|
|
2
2
|
import React from 'react'
|
|
3
3
|
|
|
4
4
|
const STATUS_COLORS = {
|
|
@@ -8,13 +8,41 @@ const STATUS_COLORS = {
|
|
|
8
8
|
deprecated: 'danger.fg'
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
+
const STATUS_BACKGROUND = {
|
|
12
|
+
alpha: 'severe.subtle',
|
|
13
|
+
beta: 'attention.subtle',
|
|
14
|
+
stable: 'success.subtle',
|
|
15
|
+
deprecated: 'danger.subtle'
|
|
16
|
+
}
|
|
17
|
+
|
|
11
18
|
function getStatusColor(status) {
|
|
12
19
|
return STATUS_COLORS[status.toLowerCase()] || 'fg.muted'
|
|
13
20
|
}
|
|
14
21
|
|
|
15
|
-
function
|
|
22
|
+
function getStatusBackgroundColor(status) {
|
|
23
|
+
return STATUS_BACKGROUND[status.toLowerCase()] || 'neutral.subtle'
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function StatusLabel({status, size}) {
|
|
27
|
+
const circleSize = size === 'large' ? 8 : 6
|
|
28
|
+
|
|
16
29
|
return (
|
|
17
|
-
<Label
|
|
30
|
+
<Label
|
|
31
|
+
as={'li'}
|
|
32
|
+
size={size || 'small'}
|
|
33
|
+
sx={{
|
|
34
|
+
display: 'inline-flex',
|
|
35
|
+
alignItems: 'center',
|
|
36
|
+
gap: 1,
|
|
37
|
+
backgroundColor: getStatusBackgroundColor(status),
|
|
38
|
+
borderColor: 'transparent',
|
|
39
|
+
fontWeight: 'normal'
|
|
40
|
+
}}
|
|
41
|
+
>
|
|
42
|
+
<Box
|
|
43
|
+
aria-hidden="true"
|
|
44
|
+
sx={{height: circleSize, width: circleSize, backgroundColor: getStatusColor(status), borderRadius: 99}}
|
|
45
|
+
/>
|
|
18
46
|
{status}
|
|
19
47
|
</Label>
|
|
20
48
|
)
|
|
@@ -1,27 +1,17 @@
|
|
|
1
|
-
import {Link, Text} from '@primer/react'
|
|
1
|
+
import {Link, Text, Box} from '@primer/react'
|
|
2
|
+
import {BookIcon} from '@primer/octicons-react'
|
|
2
3
|
import React from 'react'
|
|
3
4
|
|
|
4
5
|
function SourceLink({href}) {
|
|
5
6
|
return (
|
|
6
|
-
<
|
|
7
|
-
<
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return (
|
|
15
|
-
<svg
|
|
16
|
-
aria-hidden="true"
|
|
17
|
-
viewBox="0 0 24 24"
|
|
18
|
-
width={16}
|
|
19
|
-
height={16}
|
|
20
|
-
fill="currentColor"
|
|
21
|
-
style={{verticalAlign: 'text-bottom'}}
|
|
22
|
-
>
|
|
23
|
-
<path d="M16.71.243l-.12 2.71a.18.18 0 00.29.15l1.06-.8.9.7a.18.18 0 00.28-.14l-.1-2.76 1.33-.1a1.2 1.2 0 011.279 1.2v21.596a1.2 1.2 0 01-1.26 1.2l-16.096-.72a1.2 1.2 0 01-1.15-1.16l-.75-19.797a1.2 1.2 0 011.13-1.27L16.7.222zM13.64 9.3c0 .47 3.16.24 3.59-.08 0-3.2-1.72-4.89-4.859-4.89-3.15 0-4.899 1.72-4.899 4.29 0 4.45 5.999 4.53 5.999 6.959 0 .7-.32 1.1-1.05 1.1-.96 0-1.35-.49-1.3-2.16 0-.36-3.649-.48-3.769 0-.27 4.03 2.23 5.2 5.099 5.2 2.79 0 4.969-1.49 4.969-4.18 0-4.77-6.099-4.64-6.099-6.999 0-.97.72-1.1 1.13-1.1.45 0 1.25.07 1.19 1.87z" />
|
|
24
|
-
</svg>
|
|
7
|
+
<li>
|
|
8
|
+
<Link href={href} target="_blank">
|
|
9
|
+
<Box sx={{display: 'flex', gap: 1, alignItems: 'center'}}>
|
|
10
|
+
<BookIcon />
|
|
11
|
+
<Text>Storybook</Text>
|
|
12
|
+
</Box>
|
|
13
|
+
</Link>
|
|
14
|
+
</li>
|
|
25
15
|
)
|
|
26
16
|
}
|
|
27
17
|
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import styled from 'styled-components'
|
|
2
|
+
import {HEADER_HEIGHT} from './header'
|
|
3
|
+
|
|
4
|
+
const Superscript = styled.sup`
|
|
5
|
+
font-size: 75%;
|
|
6
|
+
line-height: 0;
|
|
7
|
+
position: relative;
|
|
8
|
+
vertical-align: baseline;
|
|
9
|
+
top: -0.5em;
|
|
10
|
+
scroll-margin-top: ${HEADER_HEIGHT + 24}px;
|
|
11
|
+
|
|
12
|
+
a {
|
|
13
|
+
text-decoration: none;
|
|
14
|
+
|
|
15
|
+
::before {
|
|
16
|
+
content: '[';
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
::after {
|
|
20
|
+
content: ']';
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
`
|
|
24
|
+
|
|
25
|
+
export default Superscript
|
package/src/components/table.js
CHANGED
|
@@ -2,28 +2,50 @@ import styled from 'styled-components'
|
|
|
2
2
|
import themeGet from '@styled-system/theme-get'
|
|
3
3
|
|
|
4
4
|
const Table = styled.table`
|
|
5
|
-
display: block;
|
|
6
5
|
width: 100%;
|
|
7
6
|
margin: 0 0 ${themeGet('space.3')};
|
|
8
7
|
overflow: auto;
|
|
8
|
+
border-collapse: separate;
|
|
9
|
+
border-spacing: 0px;
|
|
9
10
|
|
|
10
11
|
th {
|
|
11
12
|
font-weight: ${themeGet('fontWeights.bold')};
|
|
13
|
+
background-color: ${themeGet('colors.neutral.subtle')};
|
|
12
14
|
}
|
|
13
15
|
|
|
14
16
|
th,
|
|
15
17
|
td {
|
|
16
18
|
padding: ${themeGet('space.2')} ${themeGet('space.3')};
|
|
17
|
-
border:
|
|
19
|
+
border-color: ${themeGet('colors.border.muted')};
|
|
20
|
+
border-style: solid;
|
|
21
|
+
border-width: 0;
|
|
22
|
+
border-left-width: ${themeGet('borderWidths.1')};
|
|
23
|
+
border-top-width: ${themeGet('borderWidths.1')};
|
|
18
24
|
}
|
|
19
25
|
|
|
20
|
-
tr {
|
|
21
|
-
|
|
22
|
-
|
|
26
|
+
tr:last-child td {
|
|
27
|
+
border-bottom-width: ${themeGet('borderWidths.1')};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
tr td:last-child,
|
|
31
|
+
tr th:last-child {
|
|
32
|
+
border-right-width: ${themeGet('borderWidths.1')};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
thead th:first-child {
|
|
36
|
+
border-top-left-radius: ${themeGet('radii.2')};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
thead th:last-child {
|
|
40
|
+
border-top-right-radius: ${themeGet('radii.2')};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
tbody tr:last-child td:last-child {
|
|
44
|
+
border-bottom-right-radius: ${themeGet('radii.2')};
|
|
45
|
+
}
|
|
23
46
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
47
|
+
tbody tr:last-child td:first-child {
|
|
48
|
+
border-bottom-left-radius: ${themeGet('radii.2')};
|
|
27
49
|
}
|
|
28
50
|
|
|
29
51
|
img {
|
|
@@ -8,6 +8,21 @@ const GlobalStyles = createGlobalStyle`
|
|
|
8
8
|
color: ${themeGet('colors.fg.default')};
|
|
9
9
|
background-color: ${themeGet('colors.canvas.default')};
|
|
10
10
|
}
|
|
11
|
+
|
|
12
|
+
.footnotes {
|
|
13
|
+
font-size: ${themeGet('fontSizes.1')};
|
|
14
|
+
color: ${themeGet('colors.fg.subtle')};
|
|
15
|
+
|
|
16
|
+
ol {
|
|
17
|
+
padding-left: ${themeGet('space.3')};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.footnote-backref {
|
|
21
|
+
font-family: ${themeGet('fonts.mono')};
|
|
22
|
+
margin-left: 2px;
|
|
23
|
+
text-decoration: none;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
11
26
|
`
|
|
12
27
|
|
|
13
28
|
function wrapPageElement({element}) {
|
|
@@ -16,6 +16,7 @@ import InlineCode from './inline-code'
|
|
|
16
16
|
import List from './list'
|
|
17
17
|
import Note from './note'
|
|
18
18
|
import Paragraph from './paragraph'
|
|
19
|
+
import Superscript from './superscript'
|
|
19
20
|
import Table from './table'
|
|
20
21
|
|
|
21
22
|
const components = {
|
|
@@ -28,6 +29,7 @@ const components = {
|
|
|
28
29
|
p: Paragraph,
|
|
29
30
|
hr: HorizontalRule,
|
|
30
31
|
blockquote: Blockquote,
|
|
32
|
+
sup: Superscript,
|
|
31
33
|
h1: H1,
|
|
32
34
|
h2: H2,
|
|
33
35
|
h3: H3,
|