@redocly/theme 0.1.10 → 0.1.13
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/CodeBlock/CodeBlock.js +2 -1
- package/Markdown/StyledMarkdown.d.ts +0 -2
- package/Markdown/StyledMarkdown.js +5 -16
- package/Markdown/index.d.ts +0 -1
- package/Markdown/index.js +0 -1
- package/Navbar/NavbarMenu.js +1 -1
- package/OperationBadge/OperationBadge.js +1 -1
- package/Search/ClearIcon.js +2 -2
- package/Search/Input.js +1 -1
- package/Search/Popover.js +1 -1
- package/Search/SearchIcon.js +2 -2
- package/Sidebar/ApiCallItem.js +1 -1
- package/TableOfContent/TableOfContent.js +5 -6
- package/globalStyle.d.ts +1 -0
- package/globalStyle.js +25 -3
- package/mocks/Link.js +4 -1
- package/mocks/hooks/usePageData.js +4 -1
- package/package.json +1 -1
- package/src/CodeBlock/CodeBlock.ts +3 -42
- package/src/Markdown/StyledMarkdown.tsx +14 -28
- package/src/Markdown/index.ts +0 -1
- package/src/Navbar/NavbarMenu.tsx +1 -1
- package/src/OperationBadge/OperationBadge.ts +5 -2
- package/src/Search/ClearIcon.tsx +12 -13
- package/src/Search/Input.tsx +7 -7
- package/src/Search/Popover.tsx +2 -2
- package/src/Search/SearchIcon.tsx +12 -13
- package/src/Sidebar/ApiCallItem.tsx +1 -2
- package/src/TableOfContent/TableOfContent.tsx +6 -4
- package/src/globalStyle.ts +829 -536
- package/src/mocks/Link.tsx +5 -2
- package/src/mocks/hooks/usePageData.ts +4 -1
- package/src/ui/Typography.tsx +12 -89
- package/src/ui/UniversalLink.tsx +3 -8
- package/src/utils/ClipboardService.ts +3 -86
- package/src/utils/isUrl.ts +4 -4
- package/src/utils/theme-helpers.ts +46 -0
- package/ui/Typography.d.ts +2 -71
- package/ui/Typography.js +15 -93
- package/ui/UniversalLink.js +1 -5
- package/utils/ClipboardService.d.ts +1 -5
- package/utils/ClipboardService.js +2 -73
- package/utils/isUrl.d.ts +2 -2
- package/utils/isUrl.js +4 -4
- package/utils/theme-helpers.d.ts +1 -0
- package/utils/theme-helpers.js +42 -2
- package/Markdown/CodeSample/CodeSample.d.ts +0 -8
- package/Markdown/CodeSample/CodeSample.js +0 -30
- package/Markdown/CodeSample/index.d.ts +0 -3
- package/Markdown/CodeSample/index.js +0 -19
- package/Markdown/CodeSample/styled.d.ts +0 -5
- package/Markdown/CodeSample/styled.js +0 -109
- package/Markdown/CodeSample/types.d.ts +0 -9
- package/Markdown/CodeSample/types.js +0 -2
- package/src/Button/Button.stories.tsx +0 -74
- package/src/Button/__tests__/Button.test.tsx +0 -42
- package/src/Button/__tests__/__snapshots__/Button.test.tsx.snap +0 -274
- package/src/CodeBlock/__tests__/CodeBlock.test.tsx +0 -12
- package/src/CodeBlock/__tests__/__snapshots__/CodeBlock.test.tsx.snap +0 -140
- package/src/CopyButton/CopyButton.stories.tsx +0 -18
- package/src/CopyButton/__tests__/CopyButton.test.tsx +0 -35
- package/src/CopyButton/__tests__/CopyButtonWrapper.test.tsx +0 -17
- package/src/CopyButton/__tests__/__snapshots__/CopyButton.test.tsx.snap +0 -55
- package/src/CopyButton/__tests__/__snapshots__/CopyButtonWrapper.test.tsx.snap +0 -46
- package/src/Footer/Footer.stories.tsx +0 -57
- package/src/Footer/__tests__/Footer.test.tsx +0 -55
- package/src/Footer/__tests__/__snapshots__/Footer.test.tsx.snap +0 -253
- package/src/Headings/Headings.stories.tsx +0 -36
- package/src/Headings/__tests__/Headings.test.tsx +0 -24
- package/src/Headings/__tests__/__snapshots__/Headings.test.tsx.snap +0 -57
- package/src/JsonViewer/JsonViewer.stories.tsx +0 -57
- package/src/JsonViewer/__tests__/JsonViewer.test.tsx +0 -83
- package/src/JsonViewer/__tests__/__snapshots__/JsonViewer.test.tsx.snap +0 -2728
- package/src/Layout/__tests__/PageLayout.test.tsx +0 -17
- package/src/Layout/__tests__/RootLayout.test.tsx +0 -17
- package/src/Layout/__tests__/__snapshots__/PageLayout.test.tsx.snap +0 -38
- package/src/Layout/__tests__/__snapshots__/RootLayout.test.tsx.snap +0 -18
- package/src/Markdown/CodeSample/CodeSample.tsx +0 -39
- package/src/Markdown/CodeSample/index.ts +0 -3
- package/src/Markdown/CodeSample/styled.ts +0 -289
- package/src/Markdown/CodeSample/types.ts +0 -40
- package/src/Navbar/Navbar.stories.tsx +0 -32
- package/src/NavbarLogo/NavbarLogo.stories.tsx +0 -20
- package/src/NavbarLogo/__tests__/NavbarLogo.test.tsx +0 -47
- package/src/NavbarLogo/__tests__/__snapshots__/NavbarLogo.test.tsx.snap +0 -38
- package/src/OperationBadge/OperationBadge.stories.tsx +0 -35
- package/src/OperationBadge/__tests__/OperationBadge.test.tsx +0 -59
- package/src/OperationBadge/__tests__/__snapshots__/OperationBadge.test.tsx.snap +0 -651
- package/src/Panel/CodePanel.stories.tsx +0 -26
- package/src/Panel/ContentPanel.stories.tsx +0 -26
- package/src/Panel/Panel.stories.tsx +0 -56
- package/src/Panel/__tests__/CodePanel.test.tsx +0 -26
- package/src/Panel/__tests__/ContentPanel.test.tsx +0 -26
- package/src/Panel/__tests__/Panel.test.tsx +0 -53
- package/src/Panel/__tests__/__snapshots__/CodePanel.test.tsx.snap +0 -258
- package/src/Panel/__tests__/__snapshots__/ContentPanel.test.tsx.snap +0 -278
- package/src/Panel/__tests__/__snapshots__/Panel.test.tsx.snap +0 -398
- package/src/SamplesPanelControls/SamplesControlButton.stories.tsx +0 -18
- package/src/SamplesPanelControls/__tests__/SamplesPanelControls.test.tsx +0 -36
- package/src/SamplesPanelControls/__tests__/__snapshots__/SamplesPanelControls.test.tsx.snap +0 -228
- package/src/SidebarLogo/SidebarLogo.stories.tsx +0 -21
- package/src/SidebarLogo/__tests__/SidebarLogo.test.tsx +0 -32
- package/src/SidebarLogo/__tests__/__snapshots__/SidebarLogo.test.tsx.snap +0 -62
- package/src/SourceCode/SourceCode.stories.tsx +0 -29
- package/src/SourceCode/__tests__/SourceCode.test.tsx +0 -48
- package/src/SourceCode/__tests__/__snapshots__/SourceCode.test.tsx.snap +0 -786
- package/src/TableOfContent/TableOfContent.stories.tsx +0 -39
- package/src/Tooltip/Tooltip.stories.tsx +0 -27
- package/src/Tooltip/__tests__/Tooltip.test.tsx +0 -41
- package/src/Tooltip/__tests__/__snapshots__/Tooltip.test.tsx.snap +0 -83
- package/src/Welcome.stories.mdx +0 -7
- package/src/icons/ShelfIcon/ShelfIcon.stories.tsx +0 -36
- package/src/icons/ShelfIcon/__tests__/ShelfIcon.test.tsx +0 -54
- package/src/icons/ShelfIcon/__tests__/__snapshots__/ShelfIcon.test.tsx.snap +0 -235
- package/src/utils/__tests__/ClipboardService.test.ts +0 -24
- package/src/utils/__tests__/__snapshots__/highlight.test.ts.snap +0 -5
- package/src/utils/__tests__/__snapshots__/jsonToHtml.test.ts.snap +0 -5
- package/src/utils/__tests__/css-variables.test.ts +0 -20
- package/src/utils/__tests__/highlight.test.ts +0 -51
- package/src/utils/__tests__/jsonToHtml.test.ts +0 -40
- package/src/utils/__tests__/media-css.test.ts +0 -20
- package/src/utils/__tests__/theme-helpers.test.ts +0 -25
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import styled from 'styled-components';
|
|
2
2
|
|
|
3
|
+
import { generateCodeBlockTokens } from '@theme/utils';
|
|
4
|
+
|
|
3
5
|
export const CodeBlock = styled.div`
|
|
4
6
|
max-height: var(--code-block-max-height, 600px);
|
|
5
7
|
word-break: var(--code-block-word-break, initial);
|
|
@@ -42,13 +44,6 @@ export const CodeBlock = styled.div`
|
|
|
42
44
|
overflow: auto;
|
|
43
45
|
}
|
|
44
46
|
|
|
45
|
-
.token.comment,
|
|
46
|
-
.token.prolog,
|
|
47
|
-
.token.doctype,
|
|
48
|
-
.token.cdata {
|
|
49
|
-
color: hsl(30, 20%, 50%);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
47
|
.token.punctuation {
|
|
53
48
|
opacity: 1;
|
|
54
49
|
}
|
|
@@ -57,26 +52,12 @@ export const CodeBlock = styled.div`
|
|
|
57
52
|
opacity: 0.7;
|
|
58
53
|
}
|
|
59
54
|
|
|
60
|
-
.token.property,
|
|
61
|
-
.token.tag,
|
|
62
|
-
.token.number,
|
|
63
|
-
.token.constant,
|
|
64
|
-
.token.symbol {
|
|
65
|
-
color: var(--color-content-inverse);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
.token.boolean {
|
|
69
|
-
color: var(--color-error-500);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
55
|
.token.selector,
|
|
73
56
|
.token.attr-name,
|
|
74
57
|
.token.string,
|
|
75
58
|
.token.char,
|
|
76
59
|
.token.builtin,
|
|
77
60
|
.token.inserted {
|
|
78
|
-
color: #fee39e;
|
|
79
|
-
|
|
80
61
|
& + a,
|
|
81
62
|
& + a:visited {
|
|
82
63
|
color: #4ed2ba;
|
|
@@ -88,24 +69,6 @@ export const CodeBlock = styled.div`
|
|
|
88
69
|
color: #9efaa7;
|
|
89
70
|
}
|
|
90
71
|
|
|
91
|
-
.token.operator,
|
|
92
|
-
.token.entity,
|
|
93
|
-
.token.url,
|
|
94
|
-
.token.variable {
|
|
95
|
-
color: #f5b83d;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
.token.atrule,
|
|
99
|
-
.token.attr-value,
|
|
100
|
-
.token.keyword {
|
|
101
|
-
color: #ffdbf4;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
.token.regex,
|
|
105
|
-
.token.important {
|
|
106
|
-
color: #e90;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
72
|
.token.important,
|
|
110
73
|
.token.bold {
|
|
111
74
|
font-weight: bold;
|
|
@@ -119,7 +82,5 @@ export const CodeBlock = styled.div`
|
|
|
119
82
|
cursor: help;
|
|
120
83
|
}
|
|
121
84
|
|
|
122
|
-
|
|
123
|
-
color: red;
|
|
124
|
-
}
|
|
85
|
+
${generateCodeBlockTokens()}
|
|
125
86
|
`;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import styled, { css, FlattenSimpleInterpolation } from 'styled-components';
|
|
2
2
|
|
|
3
|
-
import { typography
|
|
3
|
+
import { typography } from '@theme/utils';
|
|
4
4
|
|
|
5
5
|
export const baseTable = css`
|
|
6
6
|
table {
|
|
@@ -68,19 +68,6 @@ export const baseTable = css`
|
|
|
68
68
|
}
|
|
69
69
|
`;
|
|
70
70
|
|
|
71
|
-
export function margins(theme: ITypography): FlattenSimpleInterpolation | string {
|
|
72
|
-
if (!theme) return '';
|
|
73
|
-
|
|
74
|
-
return css`
|
|
75
|
-
${{
|
|
76
|
-
marginTop: theme.marginTop || theme.marginVertical || '',
|
|
77
|
-
marginBottom: theme.marginBottom || theme.marginVertical || '',
|
|
78
|
-
marginLeft: theme.marginLeft || theme.marginHorizontal || '',
|
|
79
|
-
marginRight: theme.marginRight || theme.marginHorizontal || '',
|
|
80
|
-
}}
|
|
81
|
-
`;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
71
|
// TODO: Can users specify another className or we should hardcode it?
|
|
85
72
|
export function headingAnchor(className = 'anchor'): FlattenSimpleInterpolation {
|
|
86
73
|
return css`
|
|
@@ -220,8 +207,8 @@ export const StyledMarkdown = styled.main.attrs(() => ({
|
|
|
220
207
|
}
|
|
221
208
|
|
|
222
209
|
h1 {
|
|
223
|
-
${typography(
|
|
224
|
-
|
|
210
|
+
${typography('h1', 'h')};
|
|
211
|
+
margin: var(--h1-margin-top) var(--h1-margin-bottom);
|
|
225
212
|
${headingAnchor()};
|
|
226
213
|
|
|
227
214
|
&:first-child {
|
|
@@ -230,32 +217,32 @@ export const StyledMarkdown = styled.main.attrs(() => ({
|
|
|
230
217
|
}
|
|
231
218
|
|
|
232
219
|
h2 {
|
|
233
|
-
${typography(
|
|
234
|
-
|
|
220
|
+
${typography('h2', 'h')};
|
|
221
|
+
margin: var(--h2-margin-top) var(--h2-margin-bottom);
|
|
235
222
|
${headingAnchor()};
|
|
236
223
|
}
|
|
237
224
|
|
|
238
225
|
h3 {
|
|
239
|
-
${typography(
|
|
240
|
-
|
|
226
|
+
${typography('h3', 'h')};
|
|
227
|
+
margin: var(--h3-margin-top) var(--h3-margin-bottom);
|
|
241
228
|
${headingAnchor()};
|
|
242
229
|
}
|
|
243
230
|
|
|
244
231
|
h4 {
|
|
245
|
-
${typography(
|
|
246
|
-
|
|
232
|
+
${typography('h4', 'h')};
|
|
233
|
+
margin: var(--h4-margin-top) var(--h4-margin-bottom);
|
|
247
234
|
${headingAnchor()};
|
|
248
235
|
}
|
|
249
236
|
|
|
250
237
|
h5 {
|
|
251
|
-
${typography(
|
|
252
|
-
|
|
238
|
+
${typography('h5', 'h')};
|
|
239
|
+
margin: var(--h5-margin-top) var(--h5-margin-bottom);
|
|
253
240
|
${headingAnchor()};
|
|
254
241
|
}
|
|
255
242
|
|
|
256
243
|
h6 {
|
|
257
|
-
${typography(
|
|
258
|
-
|
|
244
|
+
${typography('h6', 'h')};
|
|
245
|
+
margin: var(--h6-margin-top) var(--h6-margin-bottom);
|
|
259
246
|
${headingAnchor()};
|
|
260
247
|
}
|
|
261
248
|
|
|
@@ -277,8 +264,7 @@ export const StyledMarkdown = styled.main.attrs(() => ({
|
|
|
277
264
|
padding: var(--bloquote-padding-vertical) var(--bloquote-padding-horizontal);
|
|
278
265
|
border-left: 4px solid var(--global-border-color);
|
|
279
266
|
background-color: var(--bloquote-background-color);
|
|
280
|
-
|
|
281
|
-
${typography(typographyTokens.blockquote)};
|
|
267
|
+
color: var(--color-content);
|
|
282
268
|
|
|
283
269
|
& > p:first-child {
|
|
284
270
|
margin-top: 0;
|
package/src/Markdown/index.ts
CHANGED
|
@@ -4,7 +4,7 @@ import styled from 'styled-components';
|
|
|
4
4
|
import { NavbarItem } from '@theme/Navbar/NavbarItem';
|
|
5
5
|
|
|
6
6
|
export function NavbarMenu({ menuItems }: { menuItems: any[] }): JSX.Element | null {
|
|
7
|
-
if (!menuItems
|
|
7
|
+
if (!menuItems?.length) {
|
|
8
8
|
return null;
|
|
9
9
|
}
|
|
10
10
|
|
|
@@ -3,7 +3,9 @@ import styled from 'styled-components';
|
|
|
3
3
|
export const OperationBadge = styled.span.attrs((props: { type: string }) => ({
|
|
4
4
|
className: `operation-type ${props.type}`,
|
|
5
5
|
}))<{ type: string }>`
|
|
6
|
-
display: inline-
|
|
6
|
+
display: inline-flex;
|
|
7
|
+
align-items: center;
|
|
8
|
+
justify-content: center;
|
|
7
9
|
font-size: var(--http-badge-menu-font-size);
|
|
8
10
|
font-family: var(--http-badge-font-family);
|
|
9
11
|
font-weight: var(--http-badge-font-weight);
|
|
@@ -41,7 +43,8 @@ export const OperationBadge = styled.span.attrs((props: { type: string }) => ({
|
|
|
41
43
|
background-color: var(--color-http-delete);
|
|
42
44
|
}
|
|
43
45
|
|
|
44
|
-
&.basic
|
|
46
|
+
&.basic,
|
|
47
|
+
&.schema {
|
|
45
48
|
background-color: var(--color-http-basic);
|
|
46
49
|
}
|
|
47
50
|
|
package/src/Search/ClearIcon.tsx
CHANGED
|
@@ -2,18 +2,17 @@ import React, { SVGProps } from 'react';
|
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
|
|
4
4
|
const Icon = (props: SVGProps<SVGSVGElement>) => (
|
|
5
|
-
<
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
</span>
|
|
5
|
+
<svg
|
|
6
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
7
|
+
version="1.1"
|
|
8
|
+
x="0"
|
|
9
|
+
y="0"
|
|
10
|
+
viewBox="0 0 298.7 298.7"
|
|
11
|
+
data-component-name="Search/ClearIcon"
|
|
12
|
+
{...props}
|
|
13
|
+
>
|
|
14
|
+
<polygon points="298.7 30.2 268.5 0 149.3 119.1 30.2 0 0 30.2 119.1 149.3 0 268.5 30.2 298.7 149.3 179.5 268.5 298.7 298.7 268.5 179.5 149.3 " />
|
|
15
|
+
</svg>
|
|
17
16
|
);
|
|
18
17
|
|
|
19
18
|
export const ClearIcon = styled(Icon)`
|
|
@@ -22,7 +21,7 @@ export const ClearIcon = styled(Icon)`
|
|
|
22
21
|
width: 0.5em;
|
|
23
22
|
height: 0.5em;
|
|
24
23
|
right: 1.2em;
|
|
25
|
-
fill: var(--input-text-color);
|
|
24
|
+
fill: var(--search-input-text-color);
|
|
26
25
|
|
|
27
26
|
${({ theme }) => theme.mediaQueries.medium} {
|
|
28
27
|
width: 0.625em;
|
package/src/Search/Input.tsx
CHANGED
|
@@ -4,16 +4,16 @@ export const FormInput = styled.input.attrs(() => ({
|
|
|
4
4
|
'data-component-name': 'Search/Input',
|
|
5
5
|
}))`
|
|
6
6
|
padding: 1em 2.5em 1em 1em;
|
|
7
|
-
background-color: var(--input-background-color);
|
|
8
|
-
border-radius: var(--input-border-radius);
|
|
7
|
+
background-color: var(--search-input-background-color);
|
|
8
|
+
border-radius: var(--search-input-border-radius);
|
|
9
9
|
border: none;
|
|
10
10
|
outline: none;
|
|
11
|
-
color: var(--input-text-color);
|
|
12
|
-
font-size: var(--input-font-size);
|
|
13
|
-
font-family: var(--input-font-family);
|
|
14
|
-
line-height: var(--input-line-height);
|
|
11
|
+
color: var(--search-input-text-color);
|
|
12
|
+
font-size: var(--search-input-font-size);
|
|
13
|
+
font-family: var(--search-input-font-family);
|
|
14
|
+
line-height: var(--search-input-line-height);
|
|
15
15
|
|
|
16
16
|
::placeholder {
|
|
17
|
-
color: var(--input-text-color);
|
|
17
|
+
color: var(--search-input-text-color);
|
|
18
18
|
}
|
|
19
19
|
`;
|
package/src/Search/Popover.tsx
CHANGED
|
@@ -14,7 +14,7 @@ export const Popover = styled.div.attrs(() => ({
|
|
|
14
14
|
overflow-y: auto;
|
|
15
15
|
box-shadow: 0 16px 24px 2px rgba(0, 0, 0, 0.14), 0 6px 30px 5px rgba(0, 0, 0, 0.12),
|
|
16
16
|
0 8px 10px -5px rgba(0, 0, 0, 0.4);
|
|
17
|
-
background: var(--popover-backgrond-color);
|
|
17
|
+
background: var(--search-popover-backgrond-color);
|
|
18
18
|
list-style: none;
|
|
19
|
-
border-radius: var(--popover-border-radius);
|
|
19
|
+
border-radius: var(--search-popover-border-radius);
|
|
20
20
|
`;
|
|
@@ -2,18 +2,17 @@ import React, { SVGProps } from 'react';
|
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
|
|
4
4
|
const Icon = (props: SVGProps<SVGSVGElement>) => (
|
|
5
|
-
<
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
</span>
|
|
5
|
+
<svg
|
|
6
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
7
|
+
version="1.1"
|
|
8
|
+
x="0"
|
|
9
|
+
y="0"
|
|
10
|
+
viewBox="0 0 490 490"
|
|
11
|
+
data-component-name="Search/SearchIcon"
|
|
12
|
+
{...props}
|
|
13
|
+
>
|
|
14
|
+
<path d="M484 455.2L366.2 337.4c29.2-35.6 46.8-81.2 46.8-130.9C413 92.5 320.5 0 206.5 0 92.4 0 0 92.5 0 206.5S92.4 413 206.5 413c49.7 0 95.2-17.5 130.8-46.7L455.1 484c8 8 20.9 8 28.9 0C492 476.1 492 463.1 484 455.2zM206.5 371.9C115.2 371.9 41 297.7 41 206.5S115.2 41 206.5 41C297.7 41 372 115.3 372 206.5S297.7 371.9 206.5 371.9z" />
|
|
15
|
+
</svg>
|
|
17
16
|
);
|
|
18
17
|
|
|
19
18
|
export const SearchIcon = styled(Icon)`
|
|
@@ -22,7 +21,7 @@ export const SearchIcon = styled(Icon)`
|
|
|
22
21
|
width: 1em;
|
|
23
22
|
height: 1em;
|
|
24
23
|
right: 1em;
|
|
25
|
-
fill: var(--input-text-color);
|
|
24
|
+
fill: var(--search-input-text-color);
|
|
26
25
|
z-index: -1;
|
|
27
26
|
|
|
28
27
|
${({ theme }) => theme.mediaQueries.medium} {
|
|
@@ -12,8 +12,7 @@ export function ApiCallItem({ item }: MenuItemProps): JSX.Element {
|
|
|
12
12
|
<Wrapper data-component-name="Sidebar/ApiCallItem">
|
|
13
13
|
<MenuLinkItem item={item}>
|
|
14
14
|
<MenuItemLabel active={item.active}>
|
|
15
|
-
{
|
|
16
|
-
<Badge type={item.httpVerb || 'event'}>
|
|
15
|
+
<Badge type={item.httpVerb || ''}>
|
|
17
16
|
{item.httpVerb === 'hook' ? 'event' : item.httpVerb}
|
|
18
17
|
</Badge>
|
|
19
18
|
{item.label}
|
|
@@ -12,13 +12,13 @@ interface TableOfContentProps {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
export function TableOfContent(props: TableOfContentProps): JSX.Element | null {
|
|
15
|
-
const { headings, tocMaxDepth } = props;
|
|
15
|
+
const { headings, tocMaxDepth, contentWrapper } = props;
|
|
16
16
|
|
|
17
17
|
const sidebar = useRef<HTMLDivElement | null>(null);
|
|
18
18
|
useFullHeight(sidebar);
|
|
19
|
-
const activeHeadingId = useActiveHeading(
|
|
19
|
+
const activeHeadingId = useActiveHeading(contentWrapper);
|
|
20
20
|
|
|
21
|
-
if (headings && headings.length === 1 && headings[0]
|
|
21
|
+
if (headings && headings.length === 1 && (!headings[0] || headings[0].depth === 1)) {
|
|
22
22
|
return null;
|
|
23
23
|
}
|
|
24
24
|
if (!headings?.length) {
|
|
@@ -46,8 +46,8 @@ export function TableOfContent(props: TableOfContentProps): JSX.Element | null {
|
|
|
46
46
|
return (
|
|
47
47
|
<MenuItem
|
|
48
48
|
key={href}
|
|
49
|
-
depth={heading.depth || 0}
|
|
50
49
|
href={href}
|
|
50
|
+
depth={heading.depth || 0}
|
|
51
51
|
className={activeHeadingId === heading.id ? 'active' : ''}
|
|
52
52
|
dangerouslySetInnerHTML={{ __html: heading.value || '' }}
|
|
53
53
|
data-cy={`toc-${heading.value}`}
|
|
@@ -79,11 +79,13 @@ const MenuItem = styled.a<{ depth: number }>`
|
|
|
79
79
|
text-decoration: none;
|
|
80
80
|
word-break: break-word;
|
|
81
81
|
font-family: var(--h-font-family);
|
|
82
|
+
|
|
82
83
|
:hover,
|
|
83
84
|
&.active {
|
|
84
85
|
color: var(--sidebar-item-active-color);
|
|
85
86
|
background-color: var(--sidebar-item-active-background-color);
|
|
86
87
|
}
|
|
88
|
+
|
|
87
89
|
:empty {
|
|
88
90
|
padding: 0;
|
|
89
91
|
}
|