@redocly/theme 0.1.15 → 0.1.20
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/CopyButton/CopyButton.js +24 -13
- package/CopyButton/CopyButtonWrapper.js +25 -13
- 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 +5 -14
- package/Footer/FooterColumn.d.ts +2 -2
- package/Footer/FooterColumn.js +10 -18
- package/Footer/FooterColumns.d.ts +6 -4
- package/Footer/FooterColumns.js +5 -15
- package/Footer/FooterCopyright.d.ts +6 -4
- package/Footer/FooterCopyright.js +2 -13
- package/JsonViewer/JsonViewer.js +33 -16
- package/JsonViewer/styled.js +1 -1
- package/Layout/PageLayout.js +4 -13
- package/Layout/RootLayout.js +5 -13
- package/Markdown/Admonition.js +5 -13
- package/Markdown/CodeSample/CodeSample.js +29 -13
- package/Markdown/CodeSample/styled.js +51 -4
- package/Markdown/Heading.js +29 -15
- package/Markdown/MarkdownLayout.js +8 -12
- package/Markdown/Mermaid.js +2 -2
- package/Markdown/Tabs/Tab.js +2 -13
- package/Markdown/Tabs/Tabs.js +33 -20
- package/Navbar/Navbar.d.ts +2 -1
- package/Navbar/Navbar.js +6 -13
- package/Navbar/NavbarDropdown.d.ts +8 -0
- package/Navbar/NavbarDropdown.js +21 -0
- package/Navbar/NavbarItem.d.ts +3 -36
- package/Navbar/NavbarItem.js +23 -23
- package/Navbar/NavbarMenu.d.ts +2 -1
- package/Navbar/NavbarMenu.js +4 -15
- package/NavbarLogo/NavbarLogo.js +3 -14
- package/PageNavigation/NextPageLink.js +7 -13
- package/PageNavigation/PageNavigation.js +4 -13
- package/PageNavigation/PreviousPageLink.js +7 -13
- package/Panel/PanelComponent.js +30 -14
- package/Search/Autocomplete.js +30 -3
- package/Search/ClearIcon.js +3 -2
- package/Search/Parameters.js +17 -17
- package/Search/Search.js +3 -13
- package/Search/SearchIcon.js +3 -2
- package/Search/SearchItem.js +30 -13
- package/Search/utils.js +28 -2
- package/Sidebar/ApiCallItem.js +7 -13
- package/Sidebar/ArrowBack.js +5 -13
- package/Sidebar/BackButton.js +4 -13
- package/Sidebar/Drilldown.js +6 -2
- package/Sidebar/DrilldownMenu.js +10 -13
- package/Sidebar/DrilldownMenuItem.js +6 -13
- package/Sidebar/ExternalIcon.js +7 -13
- package/Sidebar/MenuGroup.js +8 -13
- package/Sidebar/MenuItem.js +7 -13
- package/Sidebar/MenuLinkItem.js +2 -2
- package/Sidebar/Separator.js +4 -13
- package/Sidebar/SidebarLayout.js +6 -13
- package/SidebarLogo/SidebarLogo.js +3 -14
- package/SourceCode/SourceCode.js +11 -17
- package/TableOfContent/TableOfContent.js +40 -26
- package/Tooltip/Tooltip.js +4 -14
- package/globalStyle.js +1 -1
- package/icons/ShelfIcon/ShelfIcon.js +4 -13
- package/mocks/Link.js +5 -2
- package/package.json +1 -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/styled.ts +10 -3
- package/src/Markdown/CodeSample/styled.ts +48 -48
- package/src/Navbar/Navbar.tsx +5 -2
- package/src/Navbar/NavbarDropdown.tsx +44 -0
- package/src/Navbar/NavbarItem.tsx +44 -51
- package/src/Navbar/NavbarMenu.tsx +6 -3
- package/src/globalStyle.ts +1 -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/utils/ClipboardService.ts +19 -0
- package/ui/AlertIcon.js +20 -17
- package/ui/Arrow.js +4 -13
- package/ui/Button.js +6 -3
- package/ui/Dropdown.js +32 -14
- package/ui/Flex.js +2 -2
- package/ui/Tiles/ThinTile.js +29 -13
- package/ui/Tiles/WideTile.js +29 -13
- package/ui/UniversalLink.js +26 -3
- package/utils/ClipboardService.d.ts +1 -0
- package/utils/ClipboardService.js +19 -0
- 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/mocks/Link.js
CHANGED
|
@@ -10,15 +10,18 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
};
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
13
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
17
|
exports.Link = void 0;
|
|
15
|
-
var
|
|
18
|
+
var react_1 = __importDefault(require("react"));
|
|
16
19
|
var lodash_1 = require("lodash");
|
|
17
20
|
// TODO: use real typings here
|
|
18
21
|
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
19
22
|
function Link(props) {
|
|
20
23
|
// We omit "active" property to avoid "Warning: Received `false` for a non-boolean attribute `active`."
|
|
21
24
|
var filteredProps = (0, lodash_1.omit)(props, ['active', 'httpVerb', 'hasActiveSubItem']);
|
|
22
|
-
return
|
|
25
|
+
return react_1.default.createElement("a", __assign({ href: filteredProps.to }, filteredProps));
|
|
23
26
|
}
|
|
24
27
|
exports.Link = Link;
|
package/package.json
CHANGED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
import { CustomFooterNavItem } from '@theme/Footer/CustomFooterNavItem';
|
|
5
|
+
import { FooterCopyright } from '@theme/Footer/FooterCopyright';
|
|
6
|
+
import { NavGroupRecord, ResolvedNavItem } from '@theme/types/portal';
|
|
7
|
+
|
|
8
|
+
interface FooterProps {
|
|
9
|
+
data: NavGroupRecord;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function CustomFooter({ data }: FooterProps): JSX.Element | null {
|
|
13
|
+
if (!data) {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<FooterContainer data-component-name="Footer/CustomFooter">
|
|
19
|
+
{(data.links as ResolvedNavItem[]).map((navItem, index) => {
|
|
20
|
+
return (
|
|
21
|
+
<CustomFooterNavItem
|
|
22
|
+
key={`${navItem.label}_${index}`}
|
|
23
|
+
data-cy={navItem.label}
|
|
24
|
+
navItem={navItem}
|
|
25
|
+
/>
|
|
26
|
+
);
|
|
27
|
+
})}
|
|
28
|
+
<FooterCopyright copyrightText={data.copyrightText} />
|
|
29
|
+
</FooterContainer>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const FooterContainer = styled.div`
|
|
34
|
+
list-style: none;
|
|
35
|
+
margin: 0;
|
|
36
|
+
padding: 0;
|
|
37
|
+
display: block;
|
|
38
|
+
background-color: var(--footer-background-color);
|
|
39
|
+
text-align: center;
|
|
40
|
+
font-family: var(--font-family-base);
|
|
41
|
+
|
|
42
|
+
${({ theme }) => theme.mediaQueries.medium} {
|
|
43
|
+
display: block;
|
|
44
|
+
}
|
|
45
|
+
`;
|
|
@@ -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;
|
package/src/JsonViewer/styled.ts
CHANGED
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import { css } from 'styled-components';
|
|
2
2
|
|
|
3
3
|
export const jsonStyles = css`
|
|
4
|
-
.redoc-json code
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
.redoc-json code {
|
|
5
|
+
background-color: var(--samples-panel-controls-background-color);
|
|
6
|
+
color: var(--color-content-inverse);
|
|
7
|
+
padding: inherit;
|
|
8
|
+
border: none;
|
|
9
|
+
|
|
10
|
+
& > .collapser {
|
|
11
|
+
display: none;
|
|
12
|
+
pointer-events: none;
|
|
13
|
+
}
|
|
7
14
|
}
|
|
8
15
|
|
|
9
16
|
contain: content;
|
|
@@ -21,54 +21,54 @@ export const DoneIndicator = styled.div`
|
|
|
21
21
|
cursor: default;
|
|
22
22
|
`;
|
|
23
23
|
|
|
24
|
-
const lightStyleTokens = css`
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
`;
|
|
24
|
+
// const lightStyleTokens = css`
|
|
25
|
+
// .token.comment,
|
|
26
|
+
// .token.prolog,
|
|
27
|
+
// .token.doctype,
|
|
28
|
+
// .token.cdata {
|
|
29
|
+
// color: #999988;
|
|
30
|
+
// font-style: italic;
|
|
31
|
+
// }
|
|
32
|
+
// .token.namespace {
|
|
33
|
+
// opacity: 0.7;
|
|
34
|
+
// }
|
|
35
|
+
// .token.string,
|
|
36
|
+
// .token.attr-value {
|
|
37
|
+
// color: #e3116c;
|
|
38
|
+
// }
|
|
39
|
+
// .token.punctuation,
|
|
40
|
+
// .token.operator {
|
|
41
|
+
// color: #393a34; /* no highlight */
|
|
42
|
+
// }
|
|
43
|
+
// .token.entity,
|
|
44
|
+
// .token.url,
|
|
45
|
+
// .token.symbol,
|
|
46
|
+
// .token.number,
|
|
47
|
+
// .token.boolean,
|
|
48
|
+
// .token.variable,
|
|
49
|
+
// .token.constant,
|
|
50
|
+
// .token.property,
|
|
51
|
+
// .token.regex,
|
|
52
|
+
// .token.inserted {
|
|
53
|
+
// color: #36acaa;
|
|
54
|
+
// }
|
|
55
|
+
// .token.atrule,
|
|
56
|
+
// .token.keyword,
|
|
57
|
+
// .token.attr-name,
|
|
58
|
+
// .language-autohotkey .token.selector {
|
|
59
|
+
// color: #00a4db;
|
|
60
|
+
// }
|
|
61
|
+
// .token.function,
|
|
62
|
+
// .token.deleted,
|
|
63
|
+
// .language-autohotkey .token.tag {
|
|
64
|
+
// color: #9a050f;
|
|
65
|
+
// }
|
|
66
|
+
// .token.tag,
|
|
67
|
+
// .token.selector,
|
|
68
|
+
// .language-autohotkey .token.keyword {
|
|
69
|
+
// color: #00009f;
|
|
70
|
+
// }
|
|
71
|
+
// `;
|
|
72
72
|
|
|
73
73
|
const darkStyleTokens = css`
|
|
74
74
|
.token.comment,
|
package/src/Navbar/Navbar.tsx
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
|
|
4
|
+
import { ResolvedConfigLinks } from '@theme/types/portal';
|
|
5
|
+
import { NavbarMenu } from '@theme/Navbar';
|
|
6
|
+
|
|
4
7
|
interface NavbarProps {
|
|
5
|
-
menu:
|
|
8
|
+
menu: ResolvedConfigLinks;
|
|
6
9
|
logo: React.ReactNode;
|
|
7
10
|
search: React.ReactNode;
|
|
8
11
|
}
|
|
@@ -11,7 +14,7 @@ export function Navbar({ menu, logo, search }: NavbarProps): JSX.Element {
|
|
|
11
14
|
return (
|
|
12
15
|
<NavbarContainer data-component-name="Navbar/Navbar">
|
|
13
16
|
{logo}
|
|
14
|
-
{menu}
|
|
17
|
+
<NavbarMenu menuItems={menu} />
|
|
15
18
|
{search}
|
|
16
19
|
</NavbarContainer>
|
|
17
20
|
);
|
|
@@ -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
|
);
|
package/src/globalStyle.ts
CHANGED
|
@@ -735,6 +735,7 @@ const navbar = css`
|
|
|
735
735
|
--navbar-height: 60px; // @presenter Spacing
|
|
736
736
|
--navbar-text-color: #fff; // @presenter Color
|
|
737
737
|
--navbar-background-color: var(--color-primary-500); // @presenter Color
|
|
738
|
+
--navbar-drowpdown-shadow: 4px 4px 15px -2px rgba(0, 0, 0, 0.5);
|
|
738
739
|
|
|
739
740
|
/**
|
|
740
741
|
* @tokens Navbar Item
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import * as chokidar from 'chokidar';
|
|
3
3
|
import * as fs from 'fs';
|
|
4
|
-
import { VersionStore } from '../version-store.js';
|
|
5
4
|
import { PathVersionInfo } from '../plugins/types.js';
|
|
5
|
+
import { VersionsConfig } from './versions-config.js';
|
|
6
6
|
declare type WatchCb = (event: 'add' | 'change' | 'unlink', path: string, stats?: fs.Stats) => Promise<void>;
|
|
7
7
|
export interface ContentRecord {
|
|
8
8
|
content: string;
|
|
@@ -16,15 +16,15 @@ export interface ParsedContentRecord<T = unknown> extends ContentRecord {
|
|
|
16
16
|
export interface ContentProvider {
|
|
17
17
|
cwd: string;
|
|
18
18
|
filesList: Set<string>;
|
|
19
|
-
versions:
|
|
19
|
+
versions: VersionsConfig;
|
|
20
20
|
loadContent(relativePath: string, parse?: undefined): ContentRecord;
|
|
21
21
|
loadContent<T = unknown>(relativePath: string, parse: 'yaml'): ParsedContentRecord<T>;
|
|
22
22
|
loadContent(relativePath: string, parse: 'frontmatter'): ParsedContentRecord<{
|
|
23
23
|
content: string;
|
|
24
|
-
data:
|
|
24
|
+
data: Record<string, any>;
|
|
25
25
|
}>;
|
|
26
26
|
loadContent(relativePath: string, parse: 'yaml' | 'frontmatter' | undefined): ParsedContentRecord;
|
|
27
|
-
getVersionInfoByFsPath: (relativePath: string) => PathVersionInfo;
|
|
27
|
+
getVersionInfoByFsPath: (relativePath: string) => PathVersionInfo | undefined;
|
|
28
28
|
has(relativePath: string): boolean;
|
|
29
29
|
}
|
|
30
30
|
export declare class FsContentProvider implements ContentProvider {
|
|
@@ -32,20 +32,20 @@ export declare class FsContentProvider implements ContentProvider {
|
|
|
32
32
|
cwd: string;
|
|
33
33
|
private initialContentLoaded;
|
|
34
34
|
filesList: Set<string>;
|
|
35
|
-
versions:
|
|
35
|
+
versions: VersionsConfig;
|
|
36
36
|
constructor(cwd: string, initialCache?: Map<string, ContentRecord>);
|
|
37
37
|
private emit;
|
|
38
38
|
has(relativePath: string): boolean;
|
|
39
|
-
getVersionInfoByFsPath(relativePath: string): PathVersionInfo;
|
|
39
|
+
getVersionInfoByFsPath(relativePath: string): PathVersionInfo | undefined;
|
|
40
40
|
loadContent(relativePath: string, parse?: undefined): ContentRecord;
|
|
41
|
-
loadContent(relativePath: string, parse: 'yaml'): ParsedContentRecord<
|
|
41
|
+
loadContent<T = unknown>(relativePath: string, parse: 'yaml'): ParsedContentRecord<T>;
|
|
42
42
|
loadContent(relativePath: string, parse: 'frontmatter'): ParsedContentRecord<{
|
|
43
43
|
content: string;
|
|
44
|
-
data:
|
|
44
|
+
data: Record<string, any>;
|
|
45
45
|
}>;
|
|
46
46
|
watch(test: RegExp, cb: WatchCb): void;
|
|
47
47
|
stop(): Promise<void>;
|
|
48
48
|
start(): void;
|
|
49
|
-
ready(): Promise<chokidar.FSWatcher>;
|
|
49
|
+
ready(): Promise<chokidar.FSWatcher | undefined>;
|
|
50
50
|
}
|
|
51
51
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { Version } from '
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
export declare class
|
|
1
|
+
import type { Version } from '../../shared/types';
|
|
2
|
+
import { PathVersionInfo } from '../plugins/types';
|
|
3
|
+
import type { ContentProvider } from './content-provider';
|
|
4
|
+
export declare class VersionsConfig {
|
|
5
5
|
contentProvider: ContentProvider;
|
|
6
6
|
private config;
|
|
7
7
|
constructor(contentProvider: ContentProvider);
|
|
@@ -29,7 +29,7 @@ export declare class VersionStore {
|
|
|
29
29
|
* @param allFilePaths
|
|
30
30
|
*/
|
|
31
31
|
resolveConfig(allFilePaths: Set<string>): void;
|
|
32
|
-
getPageVersions(pagePath: string, suffix?: string): Version[];
|
|
33
|
-
getDefaultByPath(path: string): string;
|
|
34
|
-
getVersionInfoByFsPath(path: string): PathVersionInfo |
|
|
32
|
+
getPageVersions(pagePath: string, suffix?: string): Version[] | undefined;
|
|
33
|
+
getDefaultByPath(path: string): string | null | undefined;
|
|
34
|
+
getVersionInfoByFsPath(path: string): PathVersionInfo | undefined;
|
|
35
35
|
}
|