@redocly/theme 0.1.11 → 0.1.12
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/Search/ClearIcon.js +1 -1
- package/Search/Input.js +1 -1
- package/Search/Popover.js +1 -1
- package/Search/SearchIcon.js +1 -1
- package/Sidebar/ApiCallItem.js +1 -1
- package/globalStyle.js +24 -6
- package/mocks/Link.js +1 -1
- package/package.json +1 -1
- package/src/Search/ClearIcon.tsx +1 -1
- package/src/Search/Input.tsx +7 -7
- package/src/Search/Popover.tsx +2 -2
- package/src/Search/SearchIcon.tsx +1 -1
- package/src/Sidebar/ApiCallItem.tsx +1 -2
- package/src/globalStyle.ts +624 -461
- package/src/mocks/Link.tsx +1 -1
- package/src/ui/Typography.tsx +8 -8
- package/src/ui/UniversalLink.tsx +3 -8
- package/src/utils/isUrl.ts +4 -4
- package/ui/Typography.js +8 -8
- package/ui/UniversalLink.js +1 -5
- package/utils/isUrl.d.ts +2 -2
- package/utils/isUrl.js +4 -4
- 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/DesignTokens/borders.stories.mdx +0 -20
- package/src/DesignTokens/colors.stories.mdx +0 -24
- package/src/DesignTokens/page-layout.stories.mdx +0 -12
- package/src/DesignTokens/tokens-generated.scss +0 -610
- package/src/DesignTokens/typography.stories.mdx +0 -36
- 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/Navbar/Navbar.stories.tsx +0 -32
- package/src/Navbar/__tests__/Navbar.test.tsx +0 -55
- package/src/Navbar/__tests__/__snapshots__/Navbar.test.tsx.snap +0 -256
- 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/PageNavigation/PageNavigation.stories.tsx +0 -21
- package/src/PageNavigation/__tests__/NextPageLink.test.tsx +0 -29
- package/src/PageNavigation/__tests__/PageNavigation.test.tsx +0 -54
- package/src/PageNavigation/__tests__/PreviousPageLink.test.tsx +0 -29
- package/src/PageNavigation/__tests__/__snapshots__/NextPageLink.test.tsx.snap +0 -67
- package/src/PageNavigation/__tests__/__snapshots__/PageNavigation.test.tsx.snap +0 -275
- package/src/PageNavigation/__tests__/__snapshots__/PreviousPageLink.test.tsx.snap +0 -67
- 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/Search/__tests__/Input.test.tsx +0 -13
- package/src/Search/__tests__/__snapshots__/Input.test.tsx.snap +0 -36
- 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 -37
- package/src/TableOfContent/__tests__/TableOfContent.test.tsx +0 -61
- package/src/TableOfContent/__tests__/__snapshots__/TableOfContent.test.tsx.snap +0 -153
- 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,54 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
import { renderWithTheme } from '../../../tests/utils';
|
|
4
|
-
|
|
5
|
-
import { PageNavigation } from '@theme/PageNavigation/PageNavigation';
|
|
6
|
-
import { usePageData } from '@portal/hooks/usePageData';
|
|
7
|
-
|
|
8
|
-
jest.mock('@portal/hooks/usePageData');
|
|
9
|
-
|
|
10
|
-
describe('PageNavigation', () => {
|
|
11
|
-
it('renders', () => {
|
|
12
|
-
(usePageData as jest.MockedFn<any>).mockReturnValue({
|
|
13
|
-
prevPage: { type: 'link', label: 'The Previous Page', link: 'https://previous-page' },
|
|
14
|
-
nextPage: { type: 'link', label: 'The Next Page', link: 'https://next-page' },
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
const { container } = renderWithTheme(<PageNavigation />);
|
|
18
|
-
|
|
19
|
-
expect(container.firstChild).toMatchSnapshot();
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
it('renders with previous page only', () => {
|
|
23
|
-
(usePageData as jest.MockedFn<any>).mockReturnValue({
|
|
24
|
-
prevPage: { type: 'link', label: 'The Previous Page', link: 'https://previous-page' },
|
|
25
|
-
nextPage: null,
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
const { container } = renderWithTheme(<PageNavigation />);
|
|
29
|
-
|
|
30
|
-
expect(container.firstChild).toMatchSnapshot();
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
it('renders with missing next and previous pages', () => {
|
|
34
|
-
(usePageData as jest.MockedFn<any>).mockReturnValue({
|
|
35
|
-
prevPage: null,
|
|
36
|
-
nextPage: null,
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
const { container } = renderWithTheme(<PageNavigation />);
|
|
40
|
-
|
|
41
|
-
expect(container.firstChild).toMatchSnapshot();
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
it('renders with next page only', () => {
|
|
45
|
-
(usePageData as jest.MockedFn<any>).mockReturnValue({
|
|
46
|
-
prevPage: null,
|
|
47
|
-
nextPage: { type: 'link', label: 'The Next Page', link: 'https://next-page' },
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
const { container } = renderWithTheme(<PageNavigation />);
|
|
51
|
-
|
|
52
|
-
expect(container.firstChild).toMatchSnapshot();
|
|
53
|
-
});
|
|
54
|
-
});
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
import { renderWithTheme } from '../../../tests/utils';
|
|
4
|
-
|
|
5
|
-
import { PreviousPageLink } from '@theme/PageNavigation/PreviousPageLink';
|
|
6
|
-
import { usePageData } from '@portal/hooks/usePageData';
|
|
7
|
-
|
|
8
|
-
jest.mock('@portal/hooks/usePageData');
|
|
9
|
-
|
|
10
|
-
describe('PreviousPageLink', () => {
|
|
11
|
-
it('renders when prevPage is null', () => {
|
|
12
|
-
(usePageData as jest.MockedFn<any>).mockReturnValue({ prevPage: null, nextPage: null });
|
|
13
|
-
|
|
14
|
-
const { container } = renderWithTheme(<PreviousPageLink />);
|
|
15
|
-
|
|
16
|
-
expect(container.firstChild).toMatchSnapshot();
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
it('renders when prevPage exists', () => {
|
|
20
|
-
(usePageData as jest.MockedFn<any>).mockReturnValue({
|
|
21
|
-
prevPage: { type: 'link', label: 'The Previous Page', link: 'https://test.com' },
|
|
22
|
-
nextPage: null,
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
const { container } = renderWithTheme(<PreviousPageLink />);
|
|
26
|
-
|
|
27
|
-
expect(container.firstChild).toMatchSnapshot();
|
|
28
|
-
});
|
|
29
|
-
});
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`NextPageLink renders when nextPage exists 1`] = `
|
|
4
|
-
.c1 {
|
|
5
|
-
-webkit-text-decoration: none;
|
|
6
|
-
text-decoration: none;
|
|
7
|
-
text-align: center;
|
|
8
|
-
width: auto;
|
|
9
|
-
outline: none;
|
|
10
|
-
border: none;
|
|
11
|
-
border-radius: var(--button-border-radius);
|
|
12
|
-
font-weight: var(--button-font-weight);
|
|
13
|
-
font-size: 14px;
|
|
14
|
-
padding: 2px 20px;
|
|
15
|
-
cursor: pointer;
|
|
16
|
-
-webkit-transition: background-color 0.25s ease,border-color 0.25s ease,box-shadow 0.25s ease;
|
|
17
|
-
transition: background-color 0.25s ease,border-color 0.25s ease,box-shadow 0.25s ease;
|
|
18
|
-
line-height: 1;
|
|
19
|
-
font-family: var(--button-font-family);
|
|
20
|
-
box-shadow: var(--button-box-shadow);
|
|
21
|
-
color: var(--button-background-color);
|
|
22
|
-
border: 2px solid var(--button-background-color);
|
|
23
|
-
background-color: transparent;
|
|
24
|
-
font-size: var(--button-large-font-size);
|
|
25
|
-
padding: var(--button-large-padding);
|
|
26
|
-
min-width: var(--button-large-min-width);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
.c1:hover {
|
|
30
|
-
box-shadow: var(--button-active-box-shadow);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.c1:active {
|
|
34
|
-
box-shadow: var(--button-active-box-shadow);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
.c1:hover {
|
|
38
|
-
border: 2px solid var(--button-active-background-color);
|
|
39
|
-
background-color: transparent;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.c1:active {
|
|
43
|
-
border: 2px solid var(--button-outlined-active-border-color);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
.c0 + .c0 {
|
|
47
|
-
margin-left: 0.85em;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
<a
|
|
51
|
-
class="c0 c1 button-color-default"
|
|
52
|
-
data-component-name="ui/Button"
|
|
53
|
-
href="https://test.com"
|
|
54
|
-
role="button"
|
|
55
|
-
to="https://test.com"
|
|
56
|
-
variant="outlined"
|
|
57
|
-
>
|
|
58
|
-
Next to
|
|
59
|
-
The Next Page
|
|
60
|
-
</a>
|
|
61
|
-
`;
|
|
62
|
-
|
|
63
|
-
exports[`NextPageLink renders when nextPage is null 1`] = `
|
|
64
|
-
<div>
|
|
65
|
-
|
|
66
|
-
</div>
|
|
67
|
-
`;
|
|
@@ -1,275 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`PageNavigation renders 1`] = `
|
|
4
|
-
.c2 {
|
|
5
|
-
-webkit-text-decoration: none;
|
|
6
|
-
text-decoration: none;
|
|
7
|
-
text-align: center;
|
|
8
|
-
width: auto;
|
|
9
|
-
outline: none;
|
|
10
|
-
border: none;
|
|
11
|
-
border-radius: var(--button-border-radius);
|
|
12
|
-
font-weight: var(--button-font-weight);
|
|
13
|
-
font-size: 14px;
|
|
14
|
-
padding: 2px 20px;
|
|
15
|
-
cursor: pointer;
|
|
16
|
-
-webkit-transition: background-color 0.25s ease,border-color 0.25s ease,box-shadow 0.25s ease;
|
|
17
|
-
transition: background-color 0.25s ease,border-color 0.25s ease,box-shadow 0.25s ease;
|
|
18
|
-
line-height: 1;
|
|
19
|
-
font-family: var(--button-font-family);
|
|
20
|
-
box-shadow: var(--button-box-shadow);
|
|
21
|
-
color: var(--button-background-color);
|
|
22
|
-
border: 2px solid var(--button-background-color);
|
|
23
|
-
background-color: transparent;
|
|
24
|
-
font-size: var(--button-large-font-size);
|
|
25
|
-
padding: var(--button-large-padding);
|
|
26
|
-
min-width: var(--button-large-min-width);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
.c2:hover {
|
|
30
|
-
box-shadow: var(--button-active-box-shadow);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.c2:active {
|
|
34
|
-
box-shadow: var(--button-active-box-shadow);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
.c2:hover {
|
|
38
|
-
border: 2px solid var(--button-active-background-color);
|
|
39
|
-
background-color: transparent;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.c2:active {
|
|
43
|
-
border: 2px solid var(--button-outlined-active-border-color);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
.c1 + .c1 {
|
|
47
|
-
margin-left: 0.85em;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
.c0 {
|
|
51
|
-
display: -webkit-box;
|
|
52
|
-
display: -webkit-flex;
|
|
53
|
-
display: -ms-flexbox;
|
|
54
|
-
display: flex;
|
|
55
|
-
-webkit-box-pack: justify;
|
|
56
|
-
-webkit-justify-content: space-between;
|
|
57
|
-
-ms-flex-pack: justify;
|
|
58
|
-
justify-content: space-between;
|
|
59
|
-
margin: 25px 0px;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
<div
|
|
63
|
-
class="c0"
|
|
64
|
-
data-component-name="PageNavigation/PageNavigation"
|
|
65
|
-
>
|
|
66
|
-
<a
|
|
67
|
-
class="c1 c2 button-color-default"
|
|
68
|
-
data-component-name="ui/Button"
|
|
69
|
-
href="https://previous-page"
|
|
70
|
-
role="button"
|
|
71
|
-
to="https://previous-page"
|
|
72
|
-
variant="outlined"
|
|
73
|
-
>
|
|
74
|
-
Back to
|
|
75
|
-
The Previous Page
|
|
76
|
-
</a>
|
|
77
|
-
<a
|
|
78
|
-
class="c1 c2 button-color-default"
|
|
79
|
-
data-component-name="ui/Button"
|
|
80
|
-
href="https://next-page"
|
|
81
|
-
role="button"
|
|
82
|
-
to="https://next-page"
|
|
83
|
-
variant="outlined"
|
|
84
|
-
>
|
|
85
|
-
Next to
|
|
86
|
-
The Next Page
|
|
87
|
-
</a>
|
|
88
|
-
</div>
|
|
89
|
-
`;
|
|
90
|
-
|
|
91
|
-
exports[`PageNavigation renders with missing next and previous pages 1`] = `
|
|
92
|
-
.c0 {
|
|
93
|
-
display: -webkit-box;
|
|
94
|
-
display: -webkit-flex;
|
|
95
|
-
display: -ms-flexbox;
|
|
96
|
-
display: flex;
|
|
97
|
-
-webkit-box-pack: justify;
|
|
98
|
-
-webkit-justify-content: space-between;
|
|
99
|
-
-ms-flex-pack: justify;
|
|
100
|
-
justify-content: space-between;
|
|
101
|
-
margin: 25px 0px;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
<div
|
|
105
|
-
class="c0"
|
|
106
|
-
data-component-name="PageNavigation/PageNavigation"
|
|
107
|
-
>
|
|
108
|
-
<div>
|
|
109
|
-
|
|
110
|
-
</div>
|
|
111
|
-
<div>
|
|
112
|
-
|
|
113
|
-
</div>
|
|
114
|
-
</div>
|
|
115
|
-
`;
|
|
116
|
-
|
|
117
|
-
exports[`PageNavigation renders with next page only 1`] = `
|
|
118
|
-
.c2 {
|
|
119
|
-
-webkit-text-decoration: none;
|
|
120
|
-
text-decoration: none;
|
|
121
|
-
text-align: center;
|
|
122
|
-
width: auto;
|
|
123
|
-
outline: none;
|
|
124
|
-
border: none;
|
|
125
|
-
border-radius: var(--button-border-radius);
|
|
126
|
-
font-weight: var(--button-font-weight);
|
|
127
|
-
font-size: 14px;
|
|
128
|
-
padding: 2px 20px;
|
|
129
|
-
cursor: pointer;
|
|
130
|
-
-webkit-transition: background-color 0.25s ease,border-color 0.25s ease,box-shadow 0.25s ease;
|
|
131
|
-
transition: background-color 0.25s ease,border-color 0.25s ease,box-shadow 0.25s ease;
|
|
132
|
-
line-height: 1;
|
|
133
|
-
font-family: var(--button-font-family);
|
|
134
|
-
box-shadow: var(--button-box-shadow);
|
|
135
|
-
color: var(--button-background-color);
|
|
136
|
-
border: 2px solid var(--button-background-color);
|
|
137
|
-
background-color: transparent;
|
|
138
|
-
font-size: var(--button-large-font-size);
|
|
139
|
-
padding: var(--button-large-padding);
|
|
140
|
-
min-width: var(--button-large-min-width);
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
.c2:hover {
|
|
144
|
-
box-shadow: var(--button-active-box-shadow);
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
.c2:active {
|
|
148
|
-
box-shadow: var(--button-active-box-shadow);
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
.c2:hover {
|
|
152
|
-
border: 2px solid var(--button-active-background-color);
|
|
153
|
-
background-color: transparent;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
.c2:active {
|
|
157
|
-
border: 2px solid var(--button-outlined-active-border-color);
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
.c1 + .c1 {
|
|
161
|
-
margin-left: 0.85em;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
.c0 {
|
|
165
|
-
display: -webkit-box;
|
|
166
|
-
display: -webkit-flex;
|
|
167
|
-
display: -ms-flexbox;
|
|
168
|
-
display: flex;
|
|
169
|
-
-webkit-box-pack: justify;
|
|
170
|
-
-webkit-justify-content: space-between;
|
|
171
|
-
-ms-flex-pack: justify;
|
|
172
|
-
justify-content: space-between;
|
|
173
|
-
margin: 25px 0px;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
<div
|
|
177
|
-
class="c0"
|
|
178
|
-
data-component-name="PageNavigation/PageNavigation"
|
|
179
|
-
>
|
|
180
|
-
<div>
|
|
181
|
-
|
|
182
|
-
</div>
|
|
183
|
-
<a
|
|
184
|
-
class="c1 c2 button-color-default"
|
|
185
|
-
data-component-name="ui/Button"
|
|
186
|
-
href="https://next-page"
|
|
187
|
-
role="button"
|
|
188
|
-
to="https://next-page"
|
|
189
|
-
variant="outlined"
|
|
190
|
-
>
|
|
191
|
-
Next to
|
|
192
|
-
The Next Page
|
|
193
|
-
</a>
|
|
194
|
-
</div>
|
|
195
|
-
`;
|
|
196
|
-
|
|
197
|
-
exports[`PageNavigation renders with previous page only 1`] = `
|
|
198
|
-
.c2 {
|
|
199
|
-
-webkit-text-decoration: none;
|
|
200
|
-
text-decoration: none;
|
|
201
|
-
text-align: center;
|
|
202
|
-
width: auto;
|
|
203
|
-
outline: none;
|
|
204
|
-
border: none;
|
|
205
|
-
border-radius: var(--button-border-radius);
|
|
206
|
-
font-weight: var(--button-font-weight);
|
|
207
|
-
font-size: 14px;
|
|
208
|
-
padding: 2px 20px;
|
|
209
|
-
cursor: pointer;
|
|
210
|
-
-webkit-transition: background-color 0.25s ease,border-color 0.25s ease,box-shadow 0.25s ease;
|
|
211
|
-
transition: background-color 0.25s ease,border-color 0.25s ease,box-shadow 0.25s ease;
|
|
212
|
-
line-height: 1;
|
|
213
|
-
font-family: var(--button-font-family);
|
|
214
|
-
box-shadow: var(--button-box-shadow);
|
|
215
|
-
color: var(--button-background-color);
|
|
216
|
-
border: 2px solid var(--button-background-color);
|
|
217
|
-
background-color: transparent;
|
|
218
|
-
font-size: var(--button-large-font-size);
|
|
219
|
-
padding: var(--button-large-padding);
|
|
220
|
-
min-width: var(--button-large-min-width);
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
.c2:hover {
|
|
224
|
-
box-shadow: var(--button-active-box-shadow);
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
.c2:active {
|
|
228
|
-
box-shadow: var(--button-active-box-shadow);
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
.c2:hover {
|
|
232
|
-
border: 2px solid var(--button-active-background-color);
|
|
233
|
-
background-color: transparent;
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
.c2:active {
|
|
237
|
-
border: 2px solid var(--button-outlined-active-border-color);
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
.c1 + .c1 {
|
|
241
|
-
margin-left: 0.85em;
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
.c0 {
|
|
245
|
-
display: -webkit-box;
|
|
246
|
-
display: -webkit-flex;
|
|
247
|
-
display: -ms-flexbox;
|
|
248
|
-
display: flex;
|
|
249
|
-
-webkit-box-pack: justify;
|
|
250
|
-
-webkit-justify-content: space-between;
|
|
251
|
-
-ms-flex-pack: justify;
|
|
252
|
-
justify-content: space-between;
|
|
253
|
-
margin: 25px 0px;
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
<div
|
|
257
|
-
class="c0"
|
|
258
|
-
data-component-name="PageNavigation/PageNavigation"
|
|
259
|
-
>
|
|
260
|
-
<a
|
|
261
|
-
class="c1 c2 button-color-default"
|
|
262
|
-
data-component-name="ui/Button"
|
|
263
|
-
href="https://previous-page"
|
|
264
|
-
role="button"
|
|
265
|
-
to="https://previous-page"
|
|
266
|
-
variant="outlined"
|
|
267
|
-
>
|
|
268
|
-
Back to
|
|
269
|
-
The Previous Page
|
|
270
|
-
</a>
|
|
271
|
-
<div>
|
|
272
|
-
|
|
273
|
-
</div>
|
|
274
|
-
</div>
|
|
275
|
-
`;
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`PreviousPageLink renders when prevPage exists 1`] = `
|
|
4
|
-
.c1 {
|
|
5
|
-
-webkit-text-decoration: none;
|
|
6
|
-
text-decoration: none;
|
|
7
|
-
text-align: center;
|
|
8
|
-
width: auto;
|
|
9
|
-
outline: none;
|
|
10
|
-
border: none;
|
|
11
|
-
border-radius: var(--button-border-radius);
|
|
12
|
-
font-weight: var(--button-font-weight);
|
|
13
|
-
font-size: 14px;
|
|
14
|
-
padding: 2px 20px;
|
|
15
|
-
cursor: pointer;
|
|
16
|
-
-webkit-transition: background-color 0.25s ease,border-color 0.25s ease,box-shadow 0.25s ease;
|
|
17
|
-
transition: background-color 0.25s ease,border-color 0.25s ease,box-shadow 0.25s ease;
|
|
18
|
-
line-height: 1;
|
|
19
|
-
font-family: var(--button-font-family);
|
|
20
|
-
box-shadow: var(--button-box-shadow);
|
|
21
|
-
color: var(--button-background-color);
|
|
22
|
-
border: 2px solid var(--button-background-color);
|
|
23
|
-
background-color: transparent;
|
|
24
|
-
font-size: var(--button-large-font-size);
|
|
25
|
-
padding: var(--button-large-padding);
|
|
26
|
-
min-width: var(--button-large-min-width);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
.c1:hover {
|
|
30
|
-
box-shadow: var(--button-active-box-shadow);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.c1:active {
|
|
34
|
-
box-shadow: var(--button-active-box-shadow);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
.c1:hover {
|
|
38
|
-
border: 2px solid var(--button-active-background-color);
|
|
39
|
-
background-color: transparent;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.c1:active {
|
|
43
|
-
border: 2px solid var(--button-outlined-active-border-color);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
.c0 + .c0 {
|
|
47
|
-
margin-left: 0.85em;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
<a
|
|
51
|
-
class="c0 c1 button-color-default"
|
|
52
|
-
data-component-name="ui/Button"
|
|
53
|
-
href="https://test.com"
|
|
54
|
-
role="button"
|
|
55
|
-
to="https://test.com"
|
|
56
|
-
variant="outlined"
|
|
57
|
-
>
|
|
58
|
-
Back to
|
|
59
|
-
The Previous Page
|
|
60
|
-
</a>
|
|
61
|
-
`;
|
|
62
|
-
|
|
63
|
-
exports[`PreviousPageLink renders when prevPage is null 1`] = `
|
|
64
|
-
<div>
|
|
65
|
-
|
|
66
|
-
</div>
|
|
67
|
-
`;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import React, { JSXElementConstructor } from 'react';
|
|
2
|
-
import { ComponentStory, ComponentMeta } from '@storybook/react';
|
|
3
|
-
|
|
4
|
-
import { PanelComponentProps, CodePanel } from '@theme/Panel';
|
|
5
|
-
|
|
6
|
-
export default {
|
|
7
|
-
title: 'Components/Panels/CodePanel',
|
|
8
|
-
component: CodePanel,
|
|
9
|
-
} as ComponentMeta<typeof CodePanel>;
|
|
10
|
-
|
|
11
|
-
// TODO: find the way to avoid using JSXElementConstructor<PanelComponentProps> and fix types for ComponentStory<typeof CodePanel>
|
|
12
|
-
const Template: ComponentStory<JSXElementConstructor<PanelComponentProps>> = (args) => (
|
|
13
|
-
<CodePanel {...args}>Code Panel body</CodePanel>
|
|
14
|
-
);
|
|
15
|
-
|
|
16
|
-
export const Collapsed = Template.bind({});
|
|
17
|
-
Collapsed.args = {
|
|
18
|
-
header: 'Code Panel header',
|
|
19
|
-
expanded: false,
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export const Expanded = Template.bind({});
|
|
23
|
-
Expanded.args = {
|
|
24
|
-
header: 'Code Panel header',
|
|
25
|
-
expanded: true,
|
|
26
|
-
};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import React, { JSXElementConstructor } from 'react';
|
|
2
|
-
import { ComponentStory, ComponentMeta } from '@storybook/react';
|
|
3
|
-
|
|
4
|
-
import { ContentPanel, PanelComponentProps } from '@theme/Panel';
|
|
5
|
-
|
|
6
|
-
export default {
|
|
7
|
-
title: 'Components/Panels/ContentPanel',
|
|
8
|
-
component: ContentPanel,
|
|
9
|
-
} as ComponentMeta<typeof ContentPanel>;
|
|
10
|
-
|
|
11
|
-
// TODO: find the way to avoid using JSXElementConstructor<PanelComponentProps> and fix types for ComponentStory<typeof CodePanel>
|
|
12
|
-
const Template: ComponentStory<JSXElementConstructor<PanelComponentProps>> = (args) => (
|
|
13
|
-
<ContentPanel {...args}>Content Panel Body</ContentPanel>
|
|
14
|
-
);
|
|
15
|
-
|
|
16
|
-
export const Collapsed = Template.bind({});
|
|
17
|
-
Collapsed.args = {
|
|
18
|
-
header: 'Content Panel Header',
|
|
19
|
-
expanded: false,
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export const Expanded = Template.bind({});
|
|
23
|
-
Expanded.args = {
|
|
24
|
-
header: 'Content Panel Header',
|
|
25
|
-
expanded: true,
|
|
26
|
-
};
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import React, { JSXElementConstructor } from 'react';
|
|
2
|
-
import { ComponentStory, ComponentMeta } from '@storybook/react';
|
|
3
|
-
import { within, userEvent } from '@storybook/testing-library';
|
|
4
|
-
|
|
5
|
-
import { Panel, PanelHeaderProps, PanelComponentProps } from '@theme/Panel';
|
|
6
|
-
|
|
7
|
-
export default {
|
|
8
|
-
title: 'Components/Panels/Panel (base)',
|
|
9
|
-
component: Panel,
|
|
10
|
-
} as ComponentMeta<typeof Panel>;
|
|
11
|
-
|
|
12
|
-
const Template: ComponentStory<JSXElementConstructor<PanelComponentProps>> = (args) => (
|
|
13
|
-
<Panel {...args}>Panel body</Panel>
|
|
14
|
-
);
|
|
15
|
-
|
|
16
|
-
export const Default = Template.bind({});
|
|
17
|
-
Default.args = {
|
|
18
|
-
header: 'Panel header',
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export const Collapsed = Template.bind({});
|
|
22
|
-
Collapsed.args = {
|
|
23
|
-
header: 'Panel header (click me)',
|
|
24
|
-
expanded: false,
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
export const Expanded = Template.bind({});
|
|
28
|
-
Expanded.args = {
|
|
29
|
-
header: 'Panel header (click me)',
|
|
30
|
-
expanded: true,
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export const HeaderAsFunction = Template.bind({});
|
|
34
|
-
HeaderAsFunction.args = {
|
|
35
|
-
header: (props: PanelHeaderProps) => <div>Custom Header component: {JSON.stringify(props)}</div>,
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
export const HeaderAsComponent = Template.bind({});
|
|
39
|
-
HeaderAsComponent.args = {
|
|
40
|
-
header: <i>Header component</i>,
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
export const WithoutHeader = Template.bind({});
|
|
44
|
-
WithoutHeader.args = {};
|
|
45
|
-
|
|
46
|
-
// TODO: change to normal name after fixing problem with stories order!
|
|
47
|
-
export const WithDemoAnimation = Template.bind({});
|
|
48
|
-
WithDemoAnimation.args = {
|
|
49
|
-
expanded: false,
|
|
50
|
-
header: 'Panel header',
|
|
51
|
-
};
|
|
52
|
-
WithDemoAnimation.play = async ({ canvasElement }) => {
|
|
53
|
-
const canvas = within(canvasElement);
|
|
54
|
-
|
|
55
|
-
await userEvent.click(canvas.getByTestId('panel-header'));
|
|
56
|
-
};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { render } from '@testing-library/react';
|
|
3
|
-
|
|
4
|
-
import { CodePanel } from '@theme/Panel';
|
|
5
|
-
|
|
6
|
-
describe('CodePanel', () => {
|
|
7
|
-
it('renders collapsed', () => {
|
|
8
|
-
const { container } = render(
|
|
9
|
-
<CodePanel header={'CodePanel header'} expanded={false}>
|
|
10
|
-
CodePanel body
|
|
11
|
-
</CodePanel>,
|
|
12
|
-
);
|
|
13
|
-
|
|
14
|
-
expect(container.firstChild).toMatchSnapshot();
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
it('renders expanded', () => {
|
|
18
|
-
const { container } = render(
|
|
19
|
-
<CodePanel header={'CodePanel header'} expanded={true}>
|
|
20
|
-
CodePanel body
|
|
21
|
-
</CodePanel>,
|
|
22
|
-
);
|
|
23
|
-
|
|
24
|
-
expect(container.firstChild).toMatchSnapshot();
|
|
25
|
-
});
|
|
26
|
-
});
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { render } from '@testing-library/react';
|
|
3
|
-
|
|
4
|
-
import { ContentPanel } from '@theme/Panel';
|
|
5
|
-
|
|
6
|
-
describe('ContentPanel', () => {
|
|
7
|
-
it('renders collapsed', () => {
|
|
8
|
-
const { container } = render(
|
|
9
|
-
<ContentPanel header={'ContentPanel header'} expanded={false}>
|
|
10
|
-
ContentPanel body
|
|
11
|
-
</ContentPanel>,
|
|
12
|
-
);
|
|
13
|
-
|
|
14
|
-
expect(container.firstChild).toMatchSnapshot();
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
it('renders expanded', () => {
|
|
18
|
-
const { container } = render(
|
|
19
|
-
<ContentPanel header={'ContentPanel header'} expanded={true}>
|
|
20
|
-
ContentPanel body
|
|
21
|
-
</ContentPanel>,
|
|
22
|
-
);
|
|
23
|
-
|
|
24
|
-
expect(container.firstChild).toMatchSnapshot();
|
|
25
|
-
});
|
|
26
|
-
});
|