@redocly/theme 0.1.22 → 0.1.25
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/Button/Button.d.ts +1 -1
- package/Button/Button.js +3 -3
- package/CodeBlock/CodeBlock.d.ts +3 -1
- package/CodeBlock/CodeBlock.js +3 -1
- package/CopyButton/CopyButton.js +1 -1
- package/Footer/Footer.js +1 -1
- package/JsonViewer/JsonViewer.d.ts +6 -2
- package/JsonViewer/JsonViewer.js +3 -1
- package/Markdown/{StyledMarkdown.d.ts → MarkdownWrapper.d.ts} +1 -1
- package/Markdown/{StyledMarkdown.js → MarkdownWrapper.js} +3 -3
- package/Markdown/index.d.ts +1 -1
- package/Markdown/index.js +1 -1
- package/Navbar/Navbar.js +1 -1
- package/OperationBadge/OperationBadge.d.ts +2 -1
- package/OperationBadge/OperationBadge.js +1 -0
- package/PageNavigation/NextPageLink.js +2 -3
- package/PageNavigation/PreviousPageLink.js +2 -3
- package/Panel/CodePanel.d.ts +5 -1
- package/Panel/CodePanel.js +3 -1
- package/Panel/ContentPanel.d.ts +5 -1
- package/Panel/ContentPanel.js +3 -1
- package/Panel/Panel.d.ts +3 -1
- package/Panel/Panel.js +3 -1
- package/Panel/PanelBody.d.ts +3 -1
- package/Panel/PanelBody.js +3 -1
- package/Panel/PanelComponent.js +1 -1
- package/Panel/PanelHeader.d.ts +3 -1
- package/Panel/PanelHeader.js +3 -1
- package/Panel/PanelHeaderTitle.d.ts +3 -1
- package/Panel/PanelHeaderTitle.js +3 -1
- package/SamplesPanelControls/SamplesPanelControls.d.ts +6 -2
- package/SamplesPanelControls/SamplesPanelControls.js +3 -1
- package/Search/ClearIcon.d.ts +3 -1
- package/Search/ClearIcon.js +3 -1
- package/Search/SearchIcon.d.ts +3 -1
- package/Search/SearchIcon.js +3 -1
- package/Search/SidebarSearch.d.ts +3 -1
- package/Search/SidebarSearch.js +3 -1
- package/Sidebar/ApiCallItem.d.ts +2 -1
- package/Sidebar/MenuContainer.d.ts +3 -1
- package/Sidebar/MenuContainer.js +3 -1
- package/Sidebar/SeparatorItem.d.ts +2 -0
- package/Sidebar/SeparatorItem.js +3 -1
- package/SidebarLogo/SidebarLogo.js +1 -1
- package/SourceCode/SourceCode.js +2 -2
- package/Tooltip/Tooltip.js +1 -1
- package/Typography/H1.js +1 -1
- package/Typography/H2.js +1 -1
- package/Typography/H3.js +1 -1
- package/Typography/SectionHeader.d.ts +3 -1
- package/Typography/SectionHeader.js +3 -1
- package/icons/ShelfIcon/ShelfIcon.d.ts +3 -1
- package/icons/ShelfIcon/ShelfIcon.js +3 -1
- package/mocks/hooks/index.d.ts +9 -0
- package/mocks/hooks/index.js +16 -1
- package/package.json +1 -1
- package/src/Button/Button.tsx +3 -1
- package/src/CodeBlock/CodeBlock.ts +3 -1
- package/src/CopyButton/CopyButton.tsx +6 -1
- package/src/Footer/Footer.tsx +2 -2
- package/src/JsonViewer/JsonViewer.tsx +3 -1
- package/src/Markdown/{StyledMarkdown.tsx → MarkdownWrapper.tsx} +2 -2
- package/src/Markdown/index.ts +1 -1
- package/src/Navbar/Navbar.tsx +2 -2
- package/src/OperationBadge/OperationBadge.ts +1 -0
- package/src/PageNavigation/NextPageLink.tsx +10 -6
- package/src/PageNavigation/PreviousPageLink.tsx +10 -6
- package/src/Panel/CodePanel.ts +3 -1
- package/src/Panel/ContentPanel.ts +3 -1
- package/src/Panel/Panel.ts +3 -1
- package/src/Panel/PanelBody.ts +3 -1
- package/src/Panel/PanelComponent.tsx +1 -0
- package/src/Panel/PanelHeader.ts +3 -1
- package/src/Panel/PanelHeaderTitle.ts +3 -1
- package/src/SamplesPanelControls/SamplesPanelControls.ts +3 -1
- package/src/Search/ClearIcon.tsx +3 -1
- package/src/Search/SearchIcon.tsx +3 -1
- package/src/Search/SidebarSearch.tsx +3 -1
- package/src/Sidebar/MenuContainer.tsx +3 -1
- package/src/Sidebar/SeparatorItem.tsx +3 -1
- package/src/SidebarLogo/SidebarLogo.tsx +5 -1
- package/src/SourceCode/SourceCode.tsx +9 -2
- package/src/Tooltip/Tooltip.tsx +1 -0
- package/src/Typography/H1.ts +1 -1
- package/src/Typography/H2.ts +1 -1
- package/src/Typography/H3.ts +1 -1
- package/src/Typography/SectionHeader.ts +3 -1
- package/src/icons/ShelfIcon/ShelfIcon.tsx +3 -1
- package/src/mocks/hooks/index.ts +21 -0
package/Tooltip/Tooltip.js
CHANGED
|
@@ -51,7 +51,7 @@ function TooltipComponent(_a) {
|
|
|
51
51
|
var handleLeave = (0, react_1.useCallback)(function () {
|
|
52
52
|
handleClose();
|
|
53
53
|
}, [handleClose]);
|
|
54
|
-
return (react_1.default.createElement(TooltipWrapper, { onMouseEnter: isControlled ? undefined : handleEnter, onMouseLeave: isControlled ? undefined : handleLeave, onClick: isControlled ? undefined : handleLeave, className: "tooltip-".concat(className) },
|
|
54
|
+
return (react_1.default.createElement(TooltipWrapper, { onMouseEnter: isControlled ? undefined : handleEnter, onMouseLeave: isControlled ? undefined : handleLeave, onClick: isControlled ? undefined : handleLeave, className: "tooltip-".concat(className), "data-component-name": "Tooltip/Tooltip" },
|
|
55
55
|
children,
|
|
56
56
|
isOpened && (react_1.default.createElement(TooltipBody, { "data-cy": dataTestId, placement: placement, width: width }, tip))));
|
|
57
57
|
}
|
package/Typography/H1.js
CHANGED
|
@@ -11,6 +11,6 @@ exports.H1 = void 0;
|
|
|
11
11
|
var styled_components_1 = __importDefault(require("styled-components"));
|
|
12
12
|
var utils_1 = require("../utils");
|
|
13
13
|
exports.H1 = styled_components_1.default.h1.attrs(function () { return ({
|
|
14
|
-
'data-component-name': '
|
|
14
|
+
'data-component-name': 'Typography/H1',
|
|
15
15
|
}); })(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n color: var(--color-content);\n margin: 0 0 25px;\n\n ", ";\n"], ["\n color: var(--color-content);\n margin: 0 0 25px;\n\n ", ";\n"])), (0, utils_1.typography)('h1', 'h'));
|
|
16
16
|
var templateObject_1;
|
package/Typography/H2.js
CHANGED
|
@@ -11,6 +11,6 @@ exports.H2 = void 0;
|
|
|
11
11
|
var styled_components_1 = __importDefault(require("styled-components"));
|
|
12
12
|
var utils_1 = require("../utils");
|
|
13
13
|
exports.H2 = styled_components_1.default.h2.attrs(function () { return ({
|
|
14
|
-
'data-component-name': '
|
|
14
|
+
'data-component-name': 'Typography/H2',
|
|
15
15
|
}); })(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n color: var(--color-content);\n margin: 0 0 20px;\n\n ", ";\n"], ["\n color: var(--color-content);\n margin: 0 0 20px;\n\n ", ";\n"])), (0, utils_1.typography)('h2', 'h'));
|
|
16
16
|
var templateObject_1;
|
package/Typography/H3.js
CHANGED
|
@@ -11,6 +11,6 @@ exports.H3 = void 0;
|
|
|
11
11
|
var styled_components_1 = __importDefault(require("styled-components"));
|
|
12
12
|
var utils_1 = require("../utils");
|
|
13
13
|
exports.H3 = styled_components_1.default.h3.attrs(function () { return ({
|
|
14
|
-
'data-component-name': '
|
|
14
|
+
'data-component-name': 'Typography/H3',
|
|
15
15
|
}); })(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n color: var(--color-content);\n\n ", ";\n"], ["\n color: var(--color-content);\n\n ", ";\n"])), (0, utils_1.typography)('h3', 'h'));
|
|
16
16
|
var templateObject_1;
|
|
@@ -9,5 +9,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.SectionHeader = void 0;
|
|
11
11
|
var styled_components_1 = __importDefault(require("styled-components"));
|
|
12
|
-
exports.SectionHeader = styled_components_1.default.h2
|
|
12
|
+
exports.SectionHeader = styled_components_1.default.h2.attrs(function () { return ({
|
|
13
|
+
'data-component-name': 'Typography/SectionHeader',
|
|
14
|
+
}); })(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n color: var(--h-color);\n font-size: 1.75em;\n font-weight: var(--font-weight-regular);\n text-align: center;\n margin: 2.65em 0;\n padding: 0 20px;\n font-family: var(--h-font-family);\n"], ["\n color: var(--h-color);\n font-size: 1.75em;\n font-weight: var(--font-weight-regular);\n text-align: center;\n margin: 2.65em 0;\n padding: 0 20px;\n font-family: var(--h-font-family);\n"])));
|
|
13
15
|
var templateObject_1;
|
|
@@ -7,4 +7,6 @@ export interface ShelfIconProps {
|
|
|
7
7
|
direction: 'left' | 'right' | 'up' | 'down';
|
|
8
8
|
style?: React.CSSProperties;
|
|
9
9
|
}
|
|
10
|
-
export declare const ShelfIcon: import("styled-components").StyledComponent<({ className, style }: ShelfIconProps) => JSX.Element, any, {
|
|
10
|
+
export declare const ShelfIcon: import("styled-components").StyledComponent<({ className, style }: ShelfIconProps) => JSX.Element, any, {
|
|
11
|
+
'data-component-name': string;
|
|
12
|
+
}, "data-component-name">;
|
|
@@ -43,7 +43,9 @@ var IntShelfIcon = function (_a) {
|
|
|
43
43
|
React.createElement("path", { d: "M0.205025 1.19467L3.00503 3.99467C3.27839 4.26804 3.72161 4.26804 3.99497 3.99467C4.26834 3.7213 4.26834 3.27809 3.99497 3.00472L1.19497 0.20472C0.921608 -0.0686469 0.478392 -0.0686469 0.205025 0.20472C-0.0683418 0.478087 -0.0683417 0.921303 0.205025 1.19467Z" }),
|
|
44
44
|
React.createElement("path", { d: "M3.00503 3.00501L0.205025 5.80501C-0.0683417 6.07838 -0.0683417 6.5216 0.205025 6.79496C0.478392 7.06833 0.921608 7.06833 1.19497 6.79496L3.99497 3.99496C4.26834 3.7216 4.26834 3.27838 3.99497 3.00501C3.72161 2.73165 3.27839 2.73165 3.00503 3.00501Z" })));
|
|
45
45
|
};
|
|
46
|
-
exports.ShelfIcon = (0, styled_components_1.default)(IntShelfIcon)(
|
|
46
|
+
exports.ShelfIcon = (0, styled_components_1.default)(IntShelfIcon).attrs(function () { return ({
|
|
47
|
+
'data-component-name': 'icons/ShelfIcon/ShelfIcon',
|
|
48
|
+
}); })(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n ", "\n vertical-align: middle;\n transition: transform 0.2s ease-out;\n"], ["\n ", "\n vertical-align: middle;\n transition: transform 0.2s ease-out;\n"])), function (_a) {
|
|
47
49
|
var _b = _a.size, size = _b === void 0 ? '9px' : _b, _c = _a.float, float = _c === void 0 ? '' : _c, direction = _a.direction, color = _a.color;
|
|
48
50
|
return (0, styled_components_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n height: ", ";\n width: ", ";\n float: ", ";\n transform: rotateZ(", ");\n fill: ", ";\n "], ["\n height: ", ";\n width: ", ";\n float: ", ";\n transform: rotateZ(", ");\n fill: ", ";\n "])), size, size, float, directionMap[direction], (0, utils_1.getCssColorVariable)(color));
|
|
49
51
|
});
|
package/mocks/hooks/index.d.ts
CHANGED
|
@@ -2,5 +2,14 @@ interface RawTheme {
|
|
|
2
2
|
name: string;
|
|
3
3
|
settings?: any;
|
|
4
4
|
}
|
|
5
|
+
interface PageLink {
|
|
6
|
+
label: string;
|
|
7
|
+
link: string;
|
|
8
|
+
type: 'link';
|
|
9
|
+
}
|
|
5
10
|
export declare function useThemeSettings(name: string): RawTheme['settings'];
|
|
11
|
+
export declare function useSidebarSiblingsData(): {
|
|
12
|
+
nextPage: PageLink;
|
|
13
|
+
prevPage: PageLink;
|
|
14
|
+
};
|
|
6
15
|
export {};
|
package/mocks/hooks/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useThemeSettings = void 0;
|
|
3
|
+
exports.useSidebarSiblingsData = exports.useThemeSettings = void 0;
|
|
4
4
|
function useThemeSettings(name) {
|
|
5
5
|
return {
|
|
6
6
|
name: name,
|
|
@@ -14,3 +14,18 @@ function useThemeSettings(name) {
|
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
16
|
exports.useThemeSettings = useThemeSettings;
|
|
17
|
+
function useSidebarSiblingsData() {
|
|
18
|
+
return {
|
|
19
|
+
nextPage: {
|
|
20
|
+
type: 'link',
|
|
21
|
+
label: 'Page',
|
|
22
|
+
link: '#next',
|
|
23
|
+
},
|
|
24
|
+
prevPage: {
|
|
25
|
+
type: 'link',
|
|
26
|
+
label: 'Page',
|
|
27
|
+
link: '#prev',
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
exports.useSidebarSiblingsData = useSidebarSiblingsData;
|
package/package.json
CHANGED
package/src/Button/Button.tsx
CHANGED
|
@@ -127,7 +127,7 @@ const StyledButton = styled.button.attrs(({ color = 'default', extraClass }: But
|
|
|
127
127
|
`}
|
|
128
128
|
`;
|
|
129
129
|
|
|
130
|
-
|
|
130
|
+
const ButtonComponent: React.FC<ButtonProps> = (props) => {
|
|
131
131
|
if (props.to) {
|
|
132
132
|
return (
|
|
133
133
|
<Link to={props.to}>
|
|
@@ -138,3 +138,5 @@ export const Button: React.FC<ButtonProps> = (props) => {
|
|
|
138
138
|
return <StyledButton {...props} />;
|
|
139
139
|
}
|
|
140
140
|
};
|
|
141
|
+
|
|
142
|
+
export const Button = styled(ButtonComponent)``;
|
|
@@ -2,7 +2,9 @@ import styled from 'styled-components';
|
|
|
2
2
|
|
|
3
3
|
import { generateCodeBlockTokens } from '@theme/utils';
|
|
4
4
|
|
|
5
|
-
export const CodeBlock = styled.div
|
|
5
|
+
export const CodeBlock = styled.div.attrs(() => ({
|
|
6
|
+
'data-component-name': 'CodeBlock/CodeBlock',
|
|
7
|
+
}))`
|
|
6
8
|
max-height: var(--code-block-max-height, 600px);
|
|
7
9
|
word-break: var(--code-block-word-break, initial);
|
|
8
10
|
/**
|
|
@@ -19,7 +19,12 @@ export const CopyButton = ({ text, dataTestId = 'copy-button' }: CopyButtonProps
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
return (
|
|
22
|
-
<Button
|
|
22
|
+
<Button
|
|
23
|
+
color="secondary"
|
|
24
|
+
onClick={write}
|
|
25
|
+
data-cy={dataTestId}
|
|
26
|
+
data-component-name="CopyButton/CopyButton"
|
|
27
|
+
>
|
|
23
28
|
{title}
|
|
24
29
|
</Button>
|
|
25
30
|
);
|
package/src/Footer/Footer.tsx
CHANGED
|
@@ -5,14 +5,14 @@ import { FooterColumns } from '@theme/Footer/FooterColumns';
|
|
|
5
5
|
import { FooterCopyright } from '@theme/Footer/FooterCopyright';
|
|
6
6
|
import type { NavGroupRecord } from '@theme/types/portal';
|
|
7
7
|
import { useThemeSettings } from '@portal/hooks';
|
|
8
|
-
import {
|
|
8
|
+
import { DEFAULT_THEME_NAME } from '@portal/constants';
|
|
9
9
|
|
|
10
10
|
interface FooterProps {
|
|
11
11
|
data: NavGroupRecord;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
export function Footer({ data: { columns, copyrightText } }: FooterProps): JSX.Element | null {
|
|
15
|
-
const { footer } = useThemeSettings(
|
|
15
|
+
const { footer } = useThemeSettings(DEFAULT_THEME_NAME);
|
|
16
16
|
|
|
17
17
|
if (!(columns?.length || copyrightText) || footer?.hide) {
|
|
18
18
|
return null;
|
|
@@ -103,7 +103,9 @@ function JsonComponent({ data, jsonSampleExpandLevel, className }: JsonProps): J
|
|
|
103
103
|
|
|
104
104
|
export const Json = memo<JsonProps>(JsonComponent);
|
|
105
105
|
|
|
106
|
-
export const JsonViewer = styled(Json)
|
|
106
|
+
export const JsonViewer = styled(Json).attrs(() => ({
|
|
107
|
+
'data-component-name': 'JsonViewer/JsonViewer',
|
|
108
|
+
}))<JsonProps>`
|
|
107
109
|
.redoc-json code {
|
|
108
110
|
background-color: var(--samples-panel-controls-background-color);
|
|
109
111
|
color: var(--color-content-inverse);
|
|
@@ -95,8 +95,8 @@ export function headingAnchor(className = 'anchor'): FlattenSimpleInterpolation
|
|
|
95
95
|
`;
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
-
export const
|
|
99
|
-
'data-component-name': 'Markdown/
|
|
98
|
+
export const MarkdownWrapper = styled.main.attrs(() => ({
|
|
99
|
+
'data-component-name': 'Markdown/MarkdownWrapper',
|
|
100
100
|
}))`
|
|
101
101
|
font-weight: var(--font-weight-regular);
|
|
102
102
|
padding: 0;
|
package/src/Markdown/index.ts
CHANGED
|
@@ -6,4 +6,4 @@ export * from '@theme/Markdown/Heading';
|
|
|
6
6
|
export * from '@theme/Markdown/MarkdownLayout';
|
|
7
7
|
export * from '@theme/Markdown/Mermaid';
|
|
8
8
|
export * from '@theme/Markdown/PageWrapper';
|
|
9
|
-
export * from '@theme/Markdown/
|
|
9
|
+
export * from '@theme/Markdown/MarkdownWrapper';
|
package/src/Navbar/Navbar.tsx
CHANGED
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
|
|
4
4
|
import { useThemeSettings } from '@portal/hooks';
|
|
5
|
-
import {
|
|
5
|
+
import { DEFAULT_THEME_NAME } from '@portal/constants';
|
|
6
6
|
import { ResolvedConfigLinks } from '@theme/types/portal';
|
|
7
7
|
import { NavbarMenu } from '@theme/Navbar';
|
|
8
8
|
|
|
@@ -13,7 +13,7 @@ interface NavbarProps {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export function Navbar({ menu, logo, search }: NavbarProps): JSX.Element | null {
|
|
16
|
-
const settings = useThemeSettings(
|
|
16
|
+
const settings = useThemeSettings(DEFAULT_THEME_NAME);
|
|
17
17
|
const searchSettings = settings.search;
|
|
18
18
|
const hideSearch =
|
|
19
19
|
searchSettings?.hide || (searchSettings?.placement && searchSettings?.placement !== 'navbar');
|
|
@@ -2,6 +2,7 @@ import styled from 'styled-components';
|
|
|
2
2
|
|
|
3
3
|
export const OperationBadge = styled.span.attrs((props: { type: string }) => ({
|
|
4
4
|
className: `operation-type ${props.type}`,
|
|
5
|
+
'data-component-name': 'OperationBadge/OperationBadge',
|
|
5
6
|
}))<{ type: string }>`
|
|
6
7
|
display: inline-flex;
|
|
7
8
|
align-items: center;
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
import type {
|
|
4
|
-
import {
|
|
5
|
-
import { useThemeSettings } from '@portal/hooks';
|
|
3
|
+
import type { ResolvedNavItemWithLink } from '@theme/types/portal';
|
|
4
|
+
import { useThemeSettings, useSidebarSiblingsData } from '@portal/hooks';
|
|
6
5
|
import { DEFAULT_THEME_NAME } from '@portal/constants';
|
|
7
6
|
import { Button } from '@theme/Button/Button';
|
|
8
7
|
|
|
9
8
|
interface NextPageType {
|
|
10
|
-
nextPage?:
|
|
9
|
+
nextPage?: ResolvedNavItemWithLink | null;
|
|
11
10
|
}
|
|
12
11
|
|
|
13
12
|
export function NextPageLink(): JSX.Element {
|
|
14
|
-
const { nextPage }: NextPageType =
|
|
13
|
+
const { nextPage }: NextPageType = useSidebarSiblingsData() || {};
|
|
15
14
|
const { themeSettings } = useThemeSettings(DEFAULT_THEME_NAME);
|
|
16
15
|
|
|
17
16
|
if (!nextPage || themeSettings?.navigation?.hide) {
|
|
@@ -21,7 +20,12 @@ export function NextPageLink(): JSX.Element {
|
|
|
21
20
|
const label = themeSettings?.navigation?.nextPageLink?.label || `Next to ${nextPage.label}`;
|
|
22
21
|
|
|
23
22
|
return (
|
|
24
|
-
<Button
|
|
23
|
+
<Button
|
|
24
|
+
variant="outlined"
|
|
25
|
+
size="large"
|
|
26
|
+
to={nextPage.link}
|
|
27
|
+
data-component-name="PageNavigation/NextPageLink"
|
|
28
|
+
>
|
|
25
29
|
{label}
|
|
26
30
|
</Button>
|
|
27
31
|
);
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
import type {
|
|
4
|
-
import {
|
|
5
|
-
import { useThemeSettings } from '@portal/hooks';
|
|
3
|
+
import type { ResolvedNavItemWithLink } from '@theme/types/portal';
|
|
4
|
+
import { useThemeSettings, useSidebarSiblingsData } from '@portal/hooks';
|
|
6
5
|
import { DEFAULT_THEME_NAME } from '@portal/constants';
|
|
7
6
|
import { Button } from '@theme/Button/Button';
|
|
8
7
|
|
|
9
8
|
interface PreviousPageType {
|
|
10
|
-
prevPage?:
|
|
9
|
+
prevPage?: ResolvedNavItemWithLink | null;
|
|
11
10
|
}
|
|
12
11
|
|
|
13
12
|
export function PreviousPageLink(): JSX.Element {
|
|
14
|
-
const { prevPage }: PreviousPageType =
|
|
13
|
+
const { prevPage }: PreviousPageType = useSidebarSiblingsData() || {};
|
|
15
14
|
const { themeSettings } = useThemeSettings(DEFAULT_THEME_NAME);
|
|
16
15
|
|
|
17
16
|
if (!prevPage || themeSettings?.navigation?.hide) {
|
|
@@ -21,7 +20,12 @@ export function PreviousPageLink(): JSX.Element {
|
|
|
21
20
|
const label = themeSettings?.navigation?.nextPageLink?.label || `Back to ${prevPage.label}`;
|
|
22
21
|
|
|
23
22
|
return (
|
|
24
|
-
<Button
|
|
23
|
+
<Button
|
|
24
|
+
variant="outlined"
|
|
25
|
+
size="large"
|
|
26
|
+
to={prevPage.link}
|
|
27
|
+
data-component-name="PageNavigation/PreviousPageLink"
|
|
28
|
+
>
|
|
25
29
|
{label}
|
|
26
30
|
</Button>
|
|
27
31
|
);
|
package/src/Panel/CodePanel.ts
CHANGED
|
@@ -7,7 +7,9 @@ import { DarkHeader } from '@theme/Panel/DarkHeader';
|
|
|
7
7
|
import { PanelBody } from '@theme/Panel/PanelBody';
|
|
8
8
|
import { PanelHeaderTitle } from '@theme/Panel/PanelHeaderTitle';
|
|
9
9
|
|
|
10
|
-
export const CodePanel = styled(Panel)
|
|
10
|
+
export const CodePanel = styled(Panel).attrs(() => ({
|
|
11
|
+
'data-component-name': 'Panel/CodePanel',
|
|
12
|
+
}))`
|
|
11
13
|
> ${PanelHeader} {
|
|
12
14
|
${DarkHeader};
|
|
13
15
|
min-height: 50px;
|
|
@@ -6,7 +6,9 @@ import { Panel } from '@theme/Panel/Panel';
|
|
|
6
6
|
import { PanelBody } from '@theme/Panel/PanelBody';
|
|
7
7
|
import { PanelHeader } from '@theme/Panel/PanelHeader';
|
|
8
8
|
|
|
9
|
-
export const ContentPanel = styled(Panel)
|
|
9
|
+
export const ContentPanel = styled(Panel).attrs(() => ({
|
|
10
|
+
'data-component-name': 'Panel/ContentPanel',
|
|
11
|
+
}))`
|
|
10
12
|
border: 1px solid var(--global-border-color);
|
|
11
13
|
|
|
12
14
|
font-size: var(--font-size-base);
|
package/src/Panel/Panel.ts
CHANGED
|
@@ -4,7 +4,9 @@ import { PanelHeader } from '@theme/Panel/PanelHeader';
|
|
|
4
4
|
import { PanelBody } from '@theme/Panel/PanelBody';
|
|
5
5
|
import { PanelComponent } from '@theme/Panel/PanelComponent';
|
|
6
6
|
|
|
7
|
-
export const Panel = styled(PanelComponent)
|
|
7
|
+
export const Panel = styled(PanelComponent).attrs(() => ({
|
|
8
|
+
'data-component-name': 'Panel/Panel',
|
|
9
|
+
}))`
|
|
8
10
|
border-radius: var(--panels-border-radius);
|
|
9
11
|
|
|
10
12
|
${PanelHeader} + ${PanelBody} {
|
package/src/Panel/PanelBody.ts
CHANGED
|
@@ -18,7 +18,9 @@ interface PanelBodyProps {
|
|
|
18
18
|
hidden?: boolean;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
export const PanelBody = styled.div
|
|
21
|
+
export const PanelBody = styled.div.attrs(() => ({
|
|
22
|
+
'data-component-name': 'Panel/PanelBody',
|
|
23
|
+
}))<PanelBodyProps>`
|
|
22
24
|
${({ animate }) => animate && showPanelAnimation};
|
|
23
25
|
${({ hidden }) => hidden && 'visibility: hidden'};
|
|
24
26
|
|
package/src/Panel/PanelHeader.ts
CHANGED
|
@@ -7,7 +7,9 @@ export interface PanelHeaderProps {
|
|
|
7
7
|
toggle?: (e: BaseSyntheticEvent) => void;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
export const PanelHeader = styled.div
|
|
10
|
+
export const PanelHeader = styled.div.attrs(() => ({
|
|
11
|
+
'data-component-name': 'Panel/PanelHeader',
|
|
12
|
+
}))<PanelHeaderProps>`
|
|
11
13
|
position: relative;
|
|
12
14
|
z-index: 1;
|
|
13
15
|
display: flex;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import styled from 'styled-components';
|
|
2
2
|
|
|
3
|
-
export const PanelHeaderTitle = styled.span
|
|
3
|
+
export const PanelHeaderTitle = styled.span.attrs(() => ({
|
|
4
|
+
'data-component-name': 'Panel/PanelHeaderTitle',
|
|
5
|
+
}))`
|
|
4
6
|
line-height: 1;
|
|
5
7
|
margin-right: 5px;
|
|
6
8
|
font-weight: 700;
|
|
@@ -2,7 +2,9 @@ import styled from 'styled-components';
|
|
|
2
2
|
|
|
3
3
|
import { CodeBlock } from '@theme/CodeBlock';
|
|
4
4
|
|
|
5
|
-
export const SamplesControlButton = styled.button
|
|
5
|
+
export const SamplesControlButton = styled.button.attrs(() => ({
|
|
6
|
+
'data-component-name': 'SamplesPanelControls/SamplesPanelControls',
|
|
7
|
+
}))`
|
|
6
8
|
background-color: var(--samples-panel-controls-background-color);
|
|
7
9
|
border: 0;
|
|
8
10
|
outline: 0;
|
package/src/Search/ClearIcon.tsx
CHANGED
|
@@ -15,7 +15,9 @@ const Icon = (props: SVGProps<SVGSVGElement>) => (
|
|
|
15
15
|
</svg>
|
|
16
16
|
);
|
|
17
17
|
|
|
18
|
-
export const ClearIcon = styled(Icon)
|
|
18
|
+
export const ClearIcon = styled(Icon).attrs(() => ({
|
|
19
|
+
'data-component-name': 'Search/ClearIcon',
|
|
20
|
+
}))`
|
|
19
21
|
position: absolute;
|
|
20
22
|
cursor: pointer;
|
|
21
23
|
width: 0.5em;
|
|
@@ -15,7 +15,9 @@ const Icon = (props: SVGProps<SVGSVGElement>) => (
|
|
|
15
15
|
</svg>
|
|
16
16
|
);
|
|
17
17
|
|
|
18
|
-
export const SearchIcon = styled(Icon)
|
|
18
|
+
export const SearchIcon = styled(Icon).attrs(() => ({
|
|
19
|
+
'data-component-name': 'Search/SearchIcon',
|
|
20
|
+
}))`
|
|
19
21
|
position: absolute;
|
|
20
22
|
cursor: pointer;
|
|
21
23
|
width: 1em;
|
|
@@ -3,7 +3,9 @@ import styled from 'styled-components';
|
|
|
3
3
|
import { Search } from '@theme/Search/Search';
|
|
4
4
|
import { Popover } from '@theme/Search/Popover';
|
|
5
5
|
|
|
6
|
-
export const SidebarSearch = styled(Search)
|
|
6
|
+
export const SidebarSearch = styled(Search).attrs(() => ({
|
|
7
|
+
'data-component-name': 'Search/SidebarSearch',
|
|
8
|
+
}))`
|
|
7
9
|
--search-input-text-color: var(--sidebar-item-active-color);
|
|
8
10
|
|
|
9
11
|
${Popover} {
|
|
@@ -2,7 +2,9 @@ import styled from 'styled-components';
|
|
|
2
2
|
|
|
3
3
|
import { MenuItemLabel } from '@theme/Sidebar/MenuItemLabel';
|
|
4
4
|
|
|
5
|
-
export const SeparatorItem = styled(MenuItemLabel)
|
|
5
|
+
export const SeparatorItem = styled(MenuItemLabel).attrs(() => ({
|
|
6
|
+
'data-component-name': 'Sidebar/SeparatorItem',
|
|
7
|
+
}))`
|
|
6
8
|
cursor: default;
|
|
7
9
|
font-weight: var(--font-weight-bold);
|
|
8
10
|
color: var(--sidebar-separator-label-color);
|
|
@@ -23,7 +23,11 @@ export function SidebarLogo({
|
|
|
23
23
|
const logo = <LogoImgEl src={imageUrl} alt={altText || 'logo'} />;
|
|
24
24
|
|
|
25
25
|
return (
|
|
26
|
-
<LogoWrap
|
|
26
|
+
<LogoWrap
|
|
27
|
+
data-cy={dataTestId}
|
|
28
|
+
style={{ backgroundColor }}
|
|
29
|
+
data-component-name="SidebarLogo/SidebarLogo"
|
|
30
|
+
>
|
|
27
31
|
{href ? <Link href={href}>{logo}</Link> : logo}
|
|
28
32
|
</LogoWrap>
|
|
29
33
|
);
|
|
@@ -56,7 +56,7 @@ export function SourceCode({
|
|
|
56
56
|
const _source = source || externalSource?.sample?.get?.(externalSource) || '';
|
|
57
57
|
if (withCopyButton) {
|
|
58
58
|
return (
|
|
59
|
-
<CopyButtonWrapper data={source}>
|
|
59
|
+
<CopyButtonWrapper data={source} data-component-name="SourceCode/SourceCode">
|
|
60
60
|
{({ renderCopyButton }) => (
|
|
61
61
|
<SampleControlsWrap>
|
|
62
62
|
<SampleControls data-cy="copy-button">{renderCopyButton()}</SampleControls>
|
|
@@ -67,5 +67,12 @@ export function SourceCode({
|
|
|
67
67
|
);
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
return
|
|
70
|
+
return (
|
|
71
|
+
<Code
|
|
72
|
+
dataTestId={dataTestId}
|
|
73
|
+
lang={lang}
|
|
74
|
+
source={_source}
|
|
75
|
+
data-component-name="SourceCode/SourceCode"
|
|
76
|
+
/>
|
|
77
|
+
);
|
|
71
78
|
}
|
package/src/Tooltip/Tooltip.tsx
CHANGED
package/src/Typography/H1.ts
CHANGED
|
@@ -3,7 +3,7 @@ import styled from 'styled-components';
|
|
|
3
3
|
import { typography } from '@theme/utils';
|
|
4
4
|
|
|
5
5
|
export const H1 = styled.h1.attrs(() => ({
|
|
6
|
-
'data-component-name': '
|
|
6
|
+
'data-component-name': 'Typography/H1',
|
|
7
7
|
}))`
|
|
8
8
|
color: var(--color-content);
|
|
9
9
|
margin: 0 0 25px;
|
package/src/Typography/H2.ts
CHANGED
|
@@ -3,7 +3,7 @@ import styled from 'styled-components';
|
|
|
3
3
|
import { typography } from '@theme/utils';
|
|
4
4
|
|
|
5
5
|
export const H2 = styled.h2.attrs(() => ({
|
|
6
|
-
'data-component-name': '
|
|
6
|
+
'data-component-name': 'Typography/H2',
|
|
7
7
|
}))`
|
|
8
8
|
color: var(--color-content);
|
|
9
9
|
margin: 0 0 20px;
|
package/src/Typography/H3.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import styled from 'styled-components';
|
|
2
2
|
|
|
3
|
-
export const SectionHeader = styled.h2
|
|
3
|
+
export const SectionHeader = styled.h2.attrs(() => ({
|
|
4
|
+
'data-component-name': 'Typography/SectionHeader',
|
|
5
|
+
}))`
|
|
4
6
|
color: var(--h-color);
|
|
5
7
|
font-size: 1.75em;
|
|
6
8
|
font-weight: var(--font-weight-regular);
|
|
@@ -32,7 +32,9 @@ const IntShelfIcon = ({ className, style }: ShelfIconProps): JSX.Element => (
|
|
|
32
32
|
</svg>
|
|
33
33
|
);
|
|
34
34
|
|
|
35
|
-
export const ShelfIcon = styled(IntShelfIcon)
|
|
35
|
+
export const ShelfIcon = styled(IntShelfIcon).attrs(() => ({
|
|
36
|
+
'data-component-name': 'icons/ShelfIcon/ShelfIcon',
|
|
37
|
+
}))`
|
|
36
38
|
${({ size = '9px', float = '', direction, color }) => css`
|
|
37
39
|
height: ${size};
|
|
38
40
|
width: ${size};
|
package/src/mocks/hooks/index.ts
CHANGED
|
@@ -3,6 +3,12 @@ interface RawTheme {
|
|
|
3
3
|
settings?: any;
|
|
4
4
|
}
|
|
5
5
|
|
|
6
|
+
interface PageLink {
|
|
7
|
+
label: string;
|
|
8
|
+
link: string;
|
|
9
|
+
type: 'link';
|
|
10
|
+
}
|
|
11
|
+
|
|
6
12
|
export function useThemeSettings(name: string): RawTheme['settings'] {
|
|
7
13
|
return {
|
|
8
14
|
name,
|
|
@@ -15,3 +21,18 @@ export function useThemeSettings(name: string): RawTheme['settings'] {
|
|
|
15
21
|
},
|
|
16
22
|
};
|
|
17
23
|
}
|
|
24
|
+
|
|
25
|
+
export function useSidebarSiblingsData(): { nextPage: PageLink; prevPage: PageLink } {
|
|
26
|
+
return {
|
|
27
|
+
nextPage: {
|
|
28
|
+
type: 'link',
|
|
29
|
+
label: 'Page',
|
|
30
|
+
link: '#next',
|
|
31
|
+
},
|
|
32
|
+
prevPage: {
|
|
33
|
+
type: 'link',
|
|
34
|
+
label: 'Page',
|
|
35
|
+
link: '#prev',
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
}
|