@redocly/theme 0.1.16 → 0.1.21
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 +4 -3
- package/Button/Button.js +28 -1
- package/Footer/CustomFooter.d.ts +7 -0
- package/Footer/CustomFooter.js +31 -0
- package/Footer/CustomFooterNavItem.d.ts +7 -0
- package/Footer/CustomFooterNavItem.js +25 -0
- package/Footer/Footer.d.ts +6 -2
- package/Footer/Footer.js +1 -1
- package/Footer/FooterColumn.d.ts +2 -2
- package/Footer/FooterColumn.js +3 -2
- package/Footer/FooterColumns.d.ts +6 -4
- package/Footer/FooterColumns.js +3 -3
- package/Footer/FooterCopyright.d.ts +6 -4
- package/JsonViewer/JsonViewer.js +1 -2
- package/JsonViewer/index.d.ts +0 -1
- package/JsonViewer/index.js +0 -1
- package/Markdown/Admonition.js +1 -1
- package/Markdown/CodeSample/CodeSample.js +15 -5
- package/Markdown/CodeSample/index.d.ts +0 -1
- package/Markdown/CodeSample/index.js +0 -1
- package/Navbar/Navbar.d.ts +2 -1
- package/Navbar/Navbar.js +9 -2
- package/Navbar/NavbarDropdown.d.ts +8 -0
- package/Navbar/NavbarDropdown.js +21 -0
- package/Navbar/NavbarItem.d.ts +3 -36
- package/Navbar/NavbarItem.js +22 -13
- package/Navbar/NavbarMenu.d.ts +2 -1
- package/Navbar/NavbarMenu.js +1 -1
- package/PageNavigation/NextPageLink.js +8 -5
- package/PageNavigation/PreviousPageLink.js +8 -5
- package/Search/SidebarSearch.d.ts +2 -0
- package/Search/SidebarSearch.js +15 -0
- package/Sidebar/MenuGroup.js +2 -2
- package/Sidebar/SidebarLayout.js +5 -0
- package/TableOfContent/TableOfContent.js +8 -1
- package/Typography/CompactTypography.d.ts +11 -0
- package/Typography/CompactTypography.js +18 -0
- package/Typography/Emphasis.d.ts +3 -0
- package/Typography/Emphasis.js +15 -0
- package/Typography/H1.d.ts +3 -0
- package/Typography/H1.js +16 -0
- package/Typography/H2.d.ts +3 -0
- package/Typography/H2.js +16 -0
- package/Typography/H3.d.ts +3 -0
- package/Typography/H3.js +16 -0
- package/Typography/SectionHeader.d.ts +1 -0
- package/Typography/SectionHeader.js +13 -0
- package/Typography/Typography.d.ts +8 -0
- package/Typography/Typography.js +22 -0
- package/Typography/index.d.ts +7 -0
- package/{Headings → Typography}/index.js +7 -1
- package/globalStyle.js +1 -1
- package/{ui → icons/AlertIcon}/AlertIcon.d.ts +2 -2
- package/{ui → icons/AlertIcon}/AlertIcon.js +1 -1
- package/icons/AlertIcon/index.d.ts +2 -0
- package/icons/AlertIcon/index.js +5 -0
- package/icons/ArrowIcon/ArrowIcon.d.ts +7 -0
- package/{ui/Arrow.js → icons/ArrowIcon/ArrowIcon.js} +3 -3
- package/icons/ArrowIcon/index.d.ts +2 -0
- package/icons/ArrowIcon/index.js +5 -0
- package/icons/index.d.ts +2 -0
- package/icons/index.js +2 -0
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/mocks/constants/index.d.ts +2 -0
- package/mocks/constants/index.js +5 -0
- package/mocks/hooks/index.d.ts +6 -0
- package/mocks/hooks/index.js +16 -0
- package/package.json +1 -1
- package/settings.yaml +9 -0
- package/src/Button/Button.tsx +19 -1
- package/src/Footer/CustomFooter.tsx +45 -0
- package/src/Footer/CustomFooterNavItem.tsx +40 -0
- package/src/Footer/Footer.tsx +6 -2
- package/src/Footer/FooterColumn.tsx +4 -4
- package/src/Footer/FooterColumns.tsx +9 -9
- package/src/Footer/FooterCopyright.tsx +6 -6
- package/src/JsonViewer/JsonViewer.tsx +106 -2
- package/src/JsonViewer/index.ts +0 -1
- package/src/Markdown/Admonition.tsx +1 -1
- package/src/Markdown/CodeSample/CodeSample.tsx +160 -6
- package/src/Markdown/CodeSample/index.ts +0 -1
- package/src/Navbar/Navbar.tsx +13 -3
- package/src/Navbar/NavbarDropdown.tsx +44 -0
- package/src/Navbar/NavbarItem.tsx +44 -51
- package/src/Navbar/NavbarMenu.tsx +6 -3
- package/src/PageNavigation/NextPageLink.tsx +9 -3
- package/src/PageNavigation/PreviousPageLink.tsx +9 -3
- package/src/Search/SidebarSearch.tsx +13 -0
- package/src/Sidebar/MenuGroup.tsx +2 -2
- package/src/Sidebar/SidebarLayout.tsx +5 -0
- package/src/TableOfContent/TableOfContent.tsx +7 -1
- package/src/Typography/CompactTypography.ts +9 -0
- package/src/Typography/Emphasis.ts +7 -0
- package/src/Typography/H1.ts +12 -0
- package/src/Typography/H2.ts +12 -0
- package/src/Typography/H3.ts +11 -0
- package/src/Typography/SectionHeader.ts +11 -0
- package/src/Typography/Typography.ts +21 -0
- package/src/Typography/index.ts +7 -0
- package/src/globalStyle.ts +1 -0
- package/src/{ui → icons/AlertIcon}/AlertIcon.tsx +3 -3
- package/src/icons/AlertIcon/index.ts +2 -0
- package/src/{ui/Arrow.tsx → icons/ArrowIcon/ArrowIcon.tsx} +5 -5
- package/src/icons/ArrowIcon/index.ts +2 -0
- package/src/icons/index.ts +2 -0
- package/src/index.ts +1 -1
- package/src/mocks/constants/index.ts +2 -0
- package/src/mocks/hooks/index.ts +17 -0
- package/src/types/portal/index.d.ts +0 -1
- package/src/types/portal/src/client/app/Sidebar/types.d.ts +1 -1
- package/src/types/portal/src/server/{utils → content}/content-provider.d.ts +9 -9
- package/src/types/portal/src/server/{version-store.d.ts → content/versions-config.d.ts} +7 -7
- package/src/types/portal/src/server/plugins/markdown/types.d.ts +14 -11
- package/src/types/portal/src/server/plugins/portal-config/types.d.ts +16 -19
- package/src/types/portal/src/server/plugins/types.d.ts +23 -15
- package/src/types/portal/src/server/store.d.ts +32 -33
- package/src/types/portal/src/server/utils/fs.d.ts +2 -1
- package/src/types/portal/src/server/utils/index.d.ts +0 -1
- package/src/types/portal/src/server/utils/paths.d.ts +3 -3
- package/src/types/portal/src/server/utils/reporter/formatter.d.ts +2 -1
- package/src/types/portal/src/server/utils/reporter/reporter.d.ts +2 -1
- package/src/types/portal/src/shared/constants.d.ts +2 -0
- package/src/types/portal/src/shared/models/active-item.d.ts +3 -0
- package/src/types/portal/src/shared/models/config.d.ts +28 -0
- package/src/types/portal/src/shared/models/index.d.ts +6 -0
- package/src/types/portal/src/shared/models/json-index.d.ts +5 -0
- package/src/types/portal/src/shared/models/operation-parameter.d.ts +6 -0
- package/src/types/portal/src/shared/models/search-data.d.ts +5 -0
- package/src/types/portal/src/shared/models/search-document.d.ts +11 -0
- package/src/types/portal/src/shared/types.d.ts +8 -2
- package/src/types/portal/src/shared/urls.d.ts +2 -0
- package/src/types/portal/src/shared/utils.d.ts +8 -2
- package/src/ui/Jumbotron.tsx +1 -1
- package/src/ui/index.tsx +0 -4
- package/src/utils/ClipboardService.ts +19 -0
- package/ui/Jumbotron.js +1 -1
- package/ui/index.d.ts +0 -4
- package/ui/index.js +0 -4
- package/utils/ClipboardService.d.ts +1 -0
- package/utils/ClipboardService.js +19 -0
- package/Headings/Headings.d.ts +0 -3
- package/Headings/Headings.js +0 -16
- package/Headings/index.d.ts +0 -1
- package/JsonViewer/styled.d.ts +0 -1
- package/JsonViewer/styled.js +0 -10
- package/Markdown/CodeSample/styled.d.ts +0 -4
- package/Markdown/CodeSample/styled.js +0 -85
- package/src/Headings/Headings.ts +0 -23
- package/src/Headings/index.ts +0 -1
- package/src/JsonViewer/styled.ts +0 -103
- package/src/Markdown/CodeSample/styled.ts +0 -209
- package/src/types/portal/src/client/app/media-css.d.ts +0 -7
- package/src/types/portal/src/client/styling/default.d.ts +0 -601
- package/src/types/portal/src/client/styling/index.d.ts +0 -10
- package/src/types/portal/src/client/styling/resolve.d.ts +0 -1
- package/src/ui/Button.tsx +0 -19
- package/src/ui/Typography.tsx +0 -90
- package/ui/Arrow.d.ts +0 -7
- package/ui/Button.d.ts +0 -7
- package/ui/Button.js +0 -30
- package/ui/Typography.d.ts +0 -41
- package/ui/Typography.js +0 -59
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
import { Link } from '@portal/Link';
|
|
5
|
+
import type { ResolvedNavItem, ResolvedNavLinkItem } from '@theme/types/portal';
|
|
6
|
+
|
|
7
|
+
interface CustomFooterNavItemProps {
|
|
8
|
+
navItem: ResolvedNavItem;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function CustomFooterNavItem({ navItem }: CustomFooterNavItemProps): JSX.Element {
|
|
12
|
+
const item = navItem as ResolvedNavLinkItem;
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<FooterItem data-component-name="Navbar/NavbarItem">
|
|
16
|
+
<FooterLink to={item.link}>
|
|
17
|
+
<FooterLabel>{item.label}</FooterLabel>
|
|
18
|
+
</FooterLink>
|
|
19
|
+
</FooterItem>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const FooterItem = styled.li`
|
|
24
|
+
display: inline-block;
|
|
25
|
+
text-align: center;
|
|
26
|
+
line-height: var(--line-height-base);
|
|
27
|
+
font-size: var(--navbar-item-font-size);
|
|
28
|
+
margin: calc(var(--spacing-unit) * 2) calc(var(--spacing-unit) * 3);
|
|
29
|
+
font-weight: var(--font-weight-regular);
|
|
30
|
+
`;
|
|
31
|
+
|
|
32
|
+
const FooterLink = styled(Link)`
|
|
33
|
+
color: var(--footer-text-color);
|
|
34
|
+
text-decoration: none;
|
|
35
|
+
`;
|
|
36
|
+
|
|
37
|
+
const FooterLabel = styled.span`
|
|
38
|
+
cursor: pointer;
|
|
39
|
+
vertical-align: middle;
|
|
40
|
+
`;
|
package/src/Footer/Footer.tsx
CHANGED
|
@@ -3,9 +3,13 @@ import styled from 'styled-components';
|
|
|
3
3
|
|
|
4
4
|
import { FooterColumns } from '@theme/Footer/FooterColumns';
|
|
5
5
|
import { FooterCopyright } from '@theme/Footer/FooterCopyright';
|
|
6
|
-
import type {
|
|
6
|
+
import type { NavGroupRecord } from '@theme/types/portal';
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
interface FooterProps {
|
|
9
|
+
data: NavGroupRecord;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function Footer({ data: { columns, copyrightText } }: FooterProps): JSX.Element | null {
|
|
9
13
|
if (!(columns?.length || copyrightText)) {
|
|
10
14
|
return null;
|
|
11
15
|
}
|
|
@@ -2,17 +2,17 @@ import React from 'react';
|
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
|
|
4
4
|
import { Link } from '@portal/Link';
|
|
5
|
-
import type {
|
|
5
|
+
import type { ResolvedNavItem } from '@theme/types/portal';
|
|
6
6
|
|
|
7
7
|
interface FooterColumnProps {
|
|
8
|
-
column:
|
|
8
|
+
column: ResolvedNavItem;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
export function FooterColumn({ column }: FooterColumnProps): JSX.Element {
|
|
12
12
|
return (
|
|
13
13
|
<FooterColumnContainer data-component-name="Footer/FooterColumn">
|
|
14
|
-
<FooterColumnTitle>{column.
|
|
15
|
-
{column
|
|
14
|
+
<FooterColumnTitle>{column.label}</FooterColumnTitle>
|
|
15
|
+
{column?.items?.map((columnItem, columnItemIndex) => {
|
|
16
16
|
if (columnItem.type === 'error') {
|
|
17
17
|
return null;
|
|
18
18
|
}
|
|
@@ -2,14 +2,14 @@ import React from 'react';
|
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
|
|
4
4
|
import { FooterColumn } from '@theme/Footer/FooterColumn';
|
|
5
|
-
import type {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
columns
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
}): JSX.Element | null {
|
|
12
|
-
if (!columns?.length) {
|
|
5
|
+
import type { NavGroup } from '@theme/types/portal';
|
|
6
|
+
|
|
7
|
+
interface FooterColumnsProps {
|
|
8
|
+
columns: NavGroup;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function FooterColumns({ columns }: FooterColumnsProps): JSX.Element | null {
|
|
12
|
+
if (typeof columns === 'string' || typeof columns === 'undefined' || !columns?.length) {
|
|
13
13
|
return null;
|
|
14
14
|
}
|
|
15
15
|
|
|
@@ -17,7 +17,7 @@ export function FooterColumns({
|
|
|
17
17
|
<FooterColumnsContainer data-component-name="Footer/FooterColumns">
|
|
18
18
|
<FooterRow>
|
|
19
19
|
{columns.map((column, index) => (
|
|
20
|
-
<FooterColumn key={index} column={column} />
|
|
20
|
+
<FooterColumn key={`${column.label}_${index}`} column={column} />
|
|
21
21
|
))}
|
|
22
22
|
</FooterRow>
|
|
23
23
|
</FooterColumnsContainer>
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
|
|
4
|
-
import type {
|
|
4
|
+
import type { NavGroup } from '@theme/types/portal';
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
copyrightText
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
}): JSX.Element | null {
|
|
6
|
+
interface FooterCopyrightProps {
|
|
7
|
+
copyrightText: NavGroup;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function FooterCopyright({ copyrightText = '' }: FooterCopyrightProps): JSX.Element | null {
|
|
11
11
|
return copyrightText ? (
|
|
12
12
|
<Wrapper data-component-name="Footer/FooterCopyright">{copyrightText}</Wrapper>
|
|
13
13
|
) : null;
|
|
@@ -6,7 +6,6 @@ import { SampleControls, SamplesControlButton } from '@theme/SamplesPanelControl
|
|
|
6
6
|
import { jsonToHTML } from '@theme/utils';
|
|
7
7
|
import { useMount, useUnmount } from '@theme/hooks';
|
|
8
8
|
import { CodeBlock } from '@theme/CodeBlock';
|
|
9
|
-
import { jsonStyles } from '@theme/JsonViewer/styled';
|
|
10
9
|
|
|
11
10
|
export interface JsonProps {
|
|
12
11
|
data: any;
|
|
@@ -105,7 +104,112 @@ function JsonComponent({ data, jsonSampleExpandLevel, className }: JsonProps): J
|
|
|
105
104
|
export const Json = memo<JsonProps>(JsonComponent);
|
|
106
105
|
|
|
107
106
|
export const JsonViewer = styled(Json)<JsonProps>`
|
|
108
|
-
|
|
107
|
+
.redoc-json code {
|
|
108
|
+
background-color: var(--samples-panel-controls-background-color);
|
|
109
|
+
color: var(--color-content-inverse);
|
|
110
|
+
padding: inherit;
|
|
111
|
+
border: none;
|
|
112
|
+
|
|
113
|
+
& > .collapser {
|
|
114
|
+
display: none;
|
|
115
|
+
pointer-events: none;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
contain: content;
|
|
120
|
+
overflow-x: auto;
|
|
121
|
+
padding: 10px;
|
|
122
|
+
border-radius: var(--global-border-radius);
|
|
123
|
+
background-color: var(--samples-panel-controls-background-color);
|
|
124
|
+
color: var(--color-content-inverse);
|
|
125
|
+
font-size: var(--code-font-size);
|
|
126
|
+
font-family: var(--code-font-family);
|
|
127
|
+
white-space: var(--code-wrap, pre);
|
|
128
|
+
|
|
129
|
+
.callback-function {
|
|
130
|
+
color: gray;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.collapser:after {
|
|
134
|
+
content: '-';
|
|
135
|
+
cursor: pointer;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.collapsed > .collapser:after {
|
|
139
|
+
content: '+';
|
|
140
|
+
cursor: pointer;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.ellipsis:after {
|
|
144
|
+
content: ' … ';
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.collapsible {
|
|
148
|
+
margin-left: 2ch;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.hoverable {
|
|
152
|
+
padding: 1px 2px;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.hovered {
|
|
156
|
+
background-color: rgba(235, 238, 249, 1);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.collapser {
|
|
160
|
+
background-color: transparent;
|
|
161
|
+
border: 0;
|
|
162
|
+
color: #fff;
|
|
163
|
+
display: flex;
|
|
164
|
+
align-items: center;
|
|
165
|
+
justify-content: center;
|
|
166
|
+
width: 15px;
|
|
167
|
+
height: 15px;
|
|
168
|
+
position: absolute;
|
|
169
|
+
top: 4px;
|
|
170
|
+
left: -1.5em;
|
|
171
|
+
cursor: default;
|
|
172
|
+
user-select: none;
|
|
173
|
+
-webkit-user-select: none;
|
|
174
|
+
padding: 2px;
|
|
175
|
+
font-family: var(--code-font-family);
|
|
176
|
+
font-size: var(--code-font-size);
|
|
177
|
+
&:focus {
|
|
178
|
+
outline: #fff dotted 1px;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
ul {
|
|
183
|
+
list-style-type: none;
|
|
184
|
+
padding: 0;
|
|
185
|
+
margin: 0 0 0 26px;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
li {
|
|
189
|
+
position: relative;
|
|
190
|
+
display: block;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
.hoverable {
|
|
194
|
+
display: inline-block;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
.selected {
|
|
198
|
+
outline-width: 1px;
|
|
199
|
+
outline-style: dotted;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.collapsed > .collapsible {
|
|
203
|
+
display: none;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.ellipsis {
|
|
207
|
+
display: none;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
.collapsed > .ellipsis {
|
|
211
|
+
display: inherit;
|
|
212
|
+
}
|
|
109
213
|
`;
|
|
110
214
|
|
|
111
215
|
export const JsonViewerWrap = styled.div`
|
package/src/JsonViewer/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
|
|
4
|
-
import { AlertIcon } from '@theme/
|
|
4
|
+
import { AlertIcon } from '@theme/icons/AlertIcon/AlertIcon';
|
|
5
5
|
|
|
6
6
|
interface AdmonitionTypeProps {
|
|
7
7
|
type: 'warning' | 'success' | 'danger' | 'attention' | 'info';
|
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
|
+
import styled, { css } from 'styled-components';
|
|
2
3
|
|
|
3
4
|
import { ClipboardService } from '@theme/utils/ClipboardService';
|
|
4
|
-
import {
|
|
5
|
-
Wrapper,
|
|
6
|
-
DoneIndicator,
|
|
7
|
-
CopyCodeButton,
|
|
8
|
-
CodeSampleButtonContainer,
|
|
9
|
-
} from '@theme/Markdown/CodeSample/styled';
|
|
10
5
|
|
|
11
6
|
type CodeSampleProps = {
|
|
12
7
|
language: string;
|
|
@@ -37,3 +32,162 @@ export function CodeSample({ rawContent, highlighted, language }: CodeSampleProp
|
|
|
37
32
|
</Wrapper>
|
|
38
33
|
);
|
|
39
34
|
}
|
|
35
|
+
|
|
36
|
+
const CodeSampleButtonContainer = styled.div`
|
|
37
|
+
position: absolute;
|
|
38
|
+
top: 12px;
|
|
39
|
+
right: 5px;
|
|
40
|
+
`;
|
|
41
|
+
|
|
42
|
+
const CopyCodeButton = styled.div`
|
|
43
|
+
padding: 0 5px;
|
|
44
|
+
border-radius: 4px;
|
|
45
|
+
display: none;
|
|
46
|
+
&:hover {
|
|
47
|
+
cursor: pointer;
|
|
48
|
+
}
|
|
49
|
+
`;
|
|
50
|
+
|
|
51
|
+
const DoneIndicator = styled.div`
|
|
52
|
+
padding: 0 5px;
|
|
53
|
+
border-radius: 4px;
|
|
54
|
+
cursor: default;
|
|
55
|
+
`;
|
|
56
|
+
|
|
57
|
+
const darkStyleTokens = css`
|
|
58
|
+
.token.comment,
|
|
59
|
+
.token.prolog,
|
|
60
|
+
.token.doctype,
|
|
61
|
+
.token.cdata {
|
|
62
|
+
color: hsl(30, 20%, 50%);
|
|
63
|
+
}
|
|
64
|
+
.token.property,
|
|
65
|
+
.token.tag,
|
|
66
|
+
.token.number,
|
|
67
|
+
.token.constant,
|
|
68
|
+
.token.symbol {
|
|
69
|
+
color: #62bff9;
|
|
70
|
+
}
|
|
71
|
+
.token.boolean {
|
|
72
|
+
color: firebrick;
|
|
73
|
+
}
|
|
74
|
+
.token.selector,
|
|
75
|
+
.token.attr-name,
|
|
76
|
+
.token.string,
|
|
77
|
+
.token.char,
|
|
78
|
+
.token.builtin,
|
|
79
|
+
.token.inserted {
|
|
80
|
+
color: #a0fbaa;
|
|
81
|
+
& + a,
|
|
82
|
+
& + a:visited {
|
|
83
|
+
color: #4ed2ba;
|
|
84
|
+
text-decoration: underline;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
.token.operator,
|
|
88
|
+
.token.entity,
|
|
89
|
+
.token.url,
|
|
90
|
+
.token.variable {
|
|
91
|
+
color: hsl(40, 90%, 60%);
|
|
92
|
+
}
|
|
93
|
+
.token.atrule,
|
|
94
|
+
.token.attr-value,
|
|
95
|
+
.token.keyword {
|
|
96
|
+
color: hsl(350, 40%, 70%);
|
|
97
|
+
}
|
|
98
|
+
.token.regex,
|
|
99
|
+
.token.important {
|
|
100
|
+
color: #e90;
|
|
101
|
+
}
|
|
102
|
+
.token.deleted {
|
|
103
|
+
color: red;
|
|
104
|
+
}
|
|
105
|
+
`;
|
|
106
|
+
|
|
107
|
+
const Wrapper = styled.div`
|
|
108
|
+
overflow: auto;
|
|
109
|
+
border-radius: 4px;
|
|
110
|
+
position: relative;
|
|
111
|
+
|
|
112
|
+
${CopyCodeButton},
|
|
113
|
+
${DoneIndicator} {
|
|
114
|
+
color: rgba(255, 255, 255, 0.15);
|
|
115
|
+
}
|
|
116
|
+
${CopyCodeButton}:hover {
|
|
117
|
+
color: #fff;
|
|
118
|
+
background-color: rgba(255, 255, 255, 0.15);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
&:hover {
|
|
122
|
+
${CodeSampleButtonContainer} ${CopyCodeButton} {
|
|
123
|
+
display: block;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
pre {
|
|
127
|
+
white-space: var(--code-wrap);
|
|
128
|
+
color: white;
|
|
129
|
+
padding: 12px 14px 15px 14px;
|
|
130
|
+
overflow-x: auto;
|
|
131
|
+
line-height: normal;
|
|
132
|
+
border-radius: 4px;
|
|
133
|
+
font-family: var(--code-font-family);
|
|
134
|
+
background-color: var(--code-block-preformatted-background-color);
|
|
135
|
+
code {
|
|
136
|
+
background-color: transparent;
|
|
137
|
+
border: 0;
|
|
138
|
+
padding: 0;
|
|
139
|
+
color: white;
|
|
140
|
+
&:before,
|
|
141
|
+
&:after {
|
|
142
|
+
content: none;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
pre[class*='language-'] {
|
|
147
|
+
padding: 1em;
|
|
148
|
+
margin: 0.5em 0;
|
|
149
|
+
overflow: auto;
|
|
150
|
+
border: 0;
|
|
151
|
+
border-radius: var(--global-border-radius);
|
|
152
|
+
}
|
|
153
|
+
code[class='language-text'] {
|
|
154
|
+
line-height: 1.2em;
|
|
155
|
+
display: inline-flex;
|
|
156
|
+
white-space: pre-wrap;
|
|
157
|
+
overflow-wrap: anywhere;
|
|
158
|
+
}
|
|
159
|
+
code[class*='language-'],
|
|
160
|
+
pre[class*='language-'] {
|
|
161
|
+
text-align: left;
|
|
162
|
+
white-space: pre;
|
|
163
|
+
word-spacing: normal;
|
|
164
|
+
word-break: normal;
|
|
165
|
+
word-wrap: normal;
|
|
166
|
+
line-height: 1.5;
|
|
167
|
+
-moz-tab-size: 4;
|
|
168
|
+
-o-tab-size: 4;
|
|
169
|
+
tab-size: 4;
|
|
170
|
+
-webkit-hyphens: none;
|
|
171
|
+
-moz-hyphens: none;
|
|
172
|
+
-ms-hyphens: none;
|
|
173
|
+
hyphens: none;
|
|
174
|
+
.token.important,
|
|
175
|
+
.token.bold {
|
|
176
|
+
font-weight: bold;
|
|
177
|
+
}
|
|
178
|
+
.token.italic {
|
|
179
|
+
font-style: italic;
|
|
180
|
+
}
|
|
181
|
+
.token.entity {
|
|
182
|
+
cursor: help;
|
|
183
|
+
}
|
|
184
|
+
.token.punctuation {
|
|
185
|
+
opacity: 0.7;
|
|
186
|
+
}
|
|
187
|
+
.namespace {
|
|
188
|
+
opacity: 0.7;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
${darkStyleTokens};
|
|
192
|
+
}
|
|
193
|
+
`;
|
package/src/Navbar/Navbar.tsx
CHANGED
|
@@ -1,18 +1,28 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
|
|
4
|
+
import { useThemeSettings } from '@portal/hooks';
|
|
5
|
+
import { USER_THEME_ALIAS } from '@portal/constants';
|
|
6
|
+
import { ResolvedConfigLinks } from '@theme/types/portal';
|
|
7
|
+
import { NavbarMenu } from '@theme/Navbar';
|
|
8
|
+
|
|
4
9
|
interface NavbarProps {
|
|
5
|
-
menu:
|
|
10
|
+
menu: ResolvedConfigLinks;
|
|
6
11
|
logo: React.ReactNode;
|
|
7
12
|
search: React.ReactNode;
|
|
8
13
|
}
|
|
9
14
|
|
|
10
15
|
export function Navbar({ menu, logo, search }: NavbarProps): JSX.Element {
|
|
16
|
+
const searchThemeSettings = useThemeSettings(USER_THEME_ALIAS)?.search;
|
|
17
|
+
const hideSearch =
|
|
18
|
+
searchThemeSettings?.hide ||
|
|
19
|
+
(searchThemeSettings?.placement && searchThemeSettings?.placement !== 'navbar');
|
|
20
|
+
|
|
11
21
|
return (
|
|
12
22
|
<NavbarContainer data-component-name="Navbar/Navbar">
|
|
13
23
|
{logo}
|
|
14
|
-
{menu}
|
|
15
|
-
{search}
|
|
24
|
+
<NavbarMenu menuItems={menu} />
|
|
25
|
+
{hideSearch ? null : search}
|
|
16
26
|
</NavbarContainer>
|
|
17
27
|
);
|
|
18
28
|
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
import type { ResolvedNavLinkItem } from '@theme/types/portal';
|
|
5
|
+
import { Link } from '@portal/Link';
|
|
6
|
+
|
|
7
|
+
interface NavbarDropdownProps {
|
|
8
|
+
items: ResolvedNavLinkItem[];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function NavbarDropdown({ items }: NavbarDropdownProps): JSX.Element {
|
|
12
|
+
return (
|
|
13
|
+
<DropdownWrapper data-component-name="Navbar/NavbarDropdown">
|
|
14
|
+
{items.map((item, index) => (
|
|
15
|
+
<div key={`${item.label}_${index}`}>
|
|
16
|
+
<Link to={item.link}>{item.label}</Link>
|
|
17
|
+
</div>
|
|
18
|
+
))}
|
|
19
|
+
</DropdownWrapper>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const DropdownWrapper = styled.div`
|
|
24
|
+
display: none;
|
|
25
|
+
position: absolute;
|
|
26
|
+
background: var(--navbar-item-active-background-color);
|
|
27
|
+
border-radius: var(--navbar-item-border-radius);
|
|
28
|
+
padding: 10px 15px;
|
|
29
|
+
width: max-content;
|
|
30
|
+
line-height: 1rem;
|
|
31
|
+
box-shadow: var(--navbar-dropdown-shadow);
|
|
32
|
+
& > div {
|
|
33
|
+
text-align: left;
|
|
34
|
+
padding: 10px 0px;
|
|
35
|
+
cursor: pointer;
|
|
36
|
+
a {
|
|
37
|
+
color: var(--navbar-text-color);
|
|
38
|
+
text-decoration: none;
|
|
39
|
+
}
|
|
40
|
+
:hover {
|
|
41
|
+
text-decoration: underline;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
`;
|
|
@@ -2,67 +2,60 @@ import React from 'react';
|
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
import { useLocation } from 'react-router-dom';
|
|
4
4
|
|
|
5
|
+
import type {
|
|
6
|
+
ResolvedNavItem,
|
|
7
|
+
ResolvedNavLinkItem,
|
|
8
|
+
ResolvedNavGroupItem,
|
|
9
|
+
} from '@theme/types/portal';
|
|
5
10
|
import { Link } from '@portal/Link';
|
|
6
11
|
import { withPathPrefix } from '@portal/utils';
|
|
12
|
+
import { NavbarDropdown, DropdownWrapper } from '@theme/Navbar/NavbarDropdown';
|
|
7
13
|
|
|
8
|
-
|
|
9
|
-
|
|
14
|
+
interface NavbarItemProps {
|
|
15
|
+
navItem: ResolvedNavItem;
|
|
10
16
|
}
|
|
11
17
|
|
|
12
|
-
export
|
|
13
|
-
|
|
14
|
-
link: string;
|
|
15
|
-
label: string;
|
|
16
|
-
items?: ResolvedNavItem[];
|
|
17
|
-
external?: boolean;
|
|
18
|
-
version?: string;
|
|
19
|
-
default?: string;
|
|
20
|
-
httpVerb?: string; // TODO: make a separate type of item
|
|
21
|
-
separatorLine?: boolean;
|
|
22
|
-
active?: boolean;
|
|
23
|
-
};
|
|
18
|
+
export function NavbarItem({ navItem }: NavbarItemProps): JSX.Element | null {
|
|
19
|
+
const { pathname } = useLocation();
|
|
24
20
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
21
|
+
if ((navItem as ResolvedNavLinkItem).link) {
|
|
22
|
+
const item = navItem as ResolvedNavLinkItem;
|
|
23
|
+
const isActive = pathname === withPathPrefix(item.link);
|
|
24
|
+
return (
|
|
25
|
+
<NavMenuItem active={isActive} data-component-name="Navbar/NavbarItem">
|
|
26
|
+
<NavLink to={item.link} active={isActive}>
|
|
27
|
+
<NavLabel>{item.label}</NavLabel>
|
|
28
|
+
</NavLink>
|
|
29
|
+
</NavMenuItem>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
36
32
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
};
|
|
33
|
+
if ((navItem as ResolvedNavGroupItem).items) {
|
|
34
|
+
const item = navItem as ResolvedNavGroupItem;
|
|
35
|
+
return (
|
|
36
|
+
<NavMenuItemWithDropdownWrapper>
|
|
37
|
+
<NavMenuItem active={false} data-component-name="Navbar/NavbarItem">
|
|
38
|
+
<NavLabel>{item.label}</NavLabel>
|
|
39
|
+
</NavMenuItem>
|
|
40
|
+
<NavbarDropdown items={item.items as ResolvedNavLinkItem[]} />
|
|
41
|
+
</NavMenuItemWithDropdownWrapper>
|
|
42
|
+
);
|
|
43
|
+
}
|
|
49
44
|
|
|
50
|
-
|
|
51
|
-
navItem: ResolvedNavLinkItem;
|
|
45
|
+
return null;
|
|
52
46
|
}
|
|
53
47
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
48
|
+
const NavMenuItemWithDropdownWrapper = styled.div`
|
|
49
|
+
display: inline-block;
|
|
50
|
+
position: relative;
|
|
51
|
+
border-radius: var(--navbar-item-border-radius);
|
|
52
|
+
&:hover {
|
|
53
|
+
background: var(--navbar-item-active-background-color);
|
|
54
|
+
${DropdownWrapper} {
|
|
55
|
+
display: block;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
`;
|
|
66
59
|
|
|
67
60
|
const NavMenuItem = styled.li<{ active?: boolean }>`
|
|
68
61
|
display: inline-block;
|
|
@@ -2,16 +2,19 @@ import React from 'react';
|
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
|
|
4
4
|
import { NavbarItem } from '@theme/Navbar/NavbarItem';
|
|
5
|
+
import type { ResolvedConfigLinks, ResolvedNavItem } from '@theme/types/portal';
|
|
5
6
|
|
|
6
|
-
export function NavbarMenu({ menuItems }: { menuItems:
|
|
7
|
+
export function NavbarMenu({ menuItems }: { menuItems: ResolvedConfigLinks }): JSX.Element | null {
|
|
7
8
|
if (!menuItems?.length) {
|
|
8
9
|
return null;
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
return (
|
|
12
13
|
<NavItemsContainer data-component-name="Navbar/NavbarMenu">
|
|
13
|
-
{menuItems.map((navItem, index) => {
|
|
14
|
-
return
|
|
14
|
+
{(menuItems as ResolvedNavItem[]).map((navItem, index) => {
|
|
15
|
+
return (
|
|
16
|
+
<NavbarItem key={`${navItem.label}_${index}`} data-cy={navItem.label} navItem={navItem} />
|
|
17
|
+
);
|
|
15
18
|
})}
|
|
16
19
|
</NavItemsContainer>
|
|
17
20
|
);
|