@redocly/theme 0.1.8 → 0.1.11
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/index.d.ts +1 -1
- package/Button/index.js +1 -1
- package/CodeBlock/index.d.ts +1 -1
- package/CodeBlock/index.js +1 -1
- package/CopyButton/index.d.ts +2 -2
- package/CopyButton/index.js +2 -2
- package/Footer/Footer.d.ts +2 -2
- package/Footer/Footer.js +6 -5
- package/Footer/FooterColumn.d.ts +1 -1
- package/Footer/FooterColumn.js +8 -7
- package/Footer/FooterColumns.d.ts +3 -3
- package/Footer/FooterColumns.js +4 -4
- package/Footer/FooterCopyright.d.ts +3 -3
- package/Footer/FooterCopyright.js +3 -2
- package/Footer/index.d.ts +4 -4
- package/Footer/index.js +17 -11
- package/Headings/index.d.ts +1 -1
- package/Headings/index.js +1 -1
- package/JsonViewer/index.d.ts +2 -2
- package/JsonViewer/index.js +2 -2
- package/Layout/PageLayout.d.ts +1 -1
- package/Layout/PageLayout.js +2 -1
- package/Layout/RootLayout.d.ts +1 -1
- package/Layout/RootLayout.js +2 -1
- package/Layout/index.d.ts +2 -2
- package/Layout/index.js +15 -7
- package/Markdown/{Admonition/Admonition.d.ts → Admonition.d.ts} +0 -0
- package/Markdown/{Admonition/Admonition.js → Admonition.js} +5 -5
- package/Markdown/CodeSample/index.d.ts +3 -0
- package/Markdown/CodeSample/index.js +19 -0
- package/Markdown/{Heading/Heading.d.ts → Heading.d.ts} +0 -0
- package/Markdown/{Heading/Heading.js → Heading.js} +1 -1
- package/Markdown/MarkdownLayout.d.ts +2 -2
- package/Markdown/{Mermaid/Mermaid.d.ts → Mermaid.d.ts} +0 -0
- package/Markdown/{Mermaid/Mermaid.js → Mermaid.js} +0 -0
- package/Markdown/StyledMarkdown.js +2 -2
- package/Markdown/Tabs/index.d.ts +2 -0
- package/Markdown/Tabs/index.js +18 -0
- package/Markdown/index.d.ts +9 -0
- package/Markdown/index.js +25 -0
- package/Navbar/Navbar.d.ts +1 -2
- package/Navbar/Navbar.js +3 -3
- package/Navbar/NavbarItem.d.ts +1 -1
- package/Navbar/NavbarItem.js +3 -3
- package/Navbar/NavbarMenu.d.ts +1 -1
- package/Navbar/NavbarMenu.js +5 -4
- package/Navbar/index.d.ts +3 -0
- package/Navbar/index.js +19 -0
- package/NavbarLogo/NavbarLogo.d.ts +6 -0
- package/{Logo/Logo.js → NavbarLogo/NavbarLogo.js} +8 -5
- package/NavbarLogo/index.d.ts +1 -0
- package/NavbarLogo/index.js +17 -0
- package/OperationBadge/index.d.ts +1 -1
- package/OperationBadge/index.js +1 -1
- package/PageNavigation/index.d.ts +3 -0
- package/PageNavigation/index.js +19 -0
- package/Panel/index.d.ts +8 -8
- package/Panel/index.js +8 -8
- package/REAMDE.md +1 -0
- package/SamplesPanelControls/index.d.ts +1 -1
- package/SamplesPanelControls/index.js +1 -1
- package/Search/Autocomplete.js +1 -1
- package/Search/ClearIcon.js +1 -1
- package/Search/Parameters.js +2 -2
- package/Search/SearchIcon.js +1 -1
- package/Search/SearchItem.js +2 -2
- package/Search/index.d.ts +9 -0
- package/Search/index.js +25 -0
- package/Search/utils.js +1 -1
- package/Sidebar/ApiCallItem.d.ts +2 -2
- package/Sidebar/ApiCallItem.js +6 -6
- package/Sidebar/ArrowBack.d.ts +1 -2
- package/Sidebar/ArrowBack.js +2 -1
- package/Sidebar/BackButton.d.ts +1 -1
- package/Sidebar/BackButton.js +5 -4
- package/Sidebar/Drilldown.d.ts +2 -2
- package/Sidebar/Drilldown.js +8 -7
- package/Sidebar/DrilldownMenu.d.ts +2 -2
- package/Sidebar/DrilldownMenu.js +5 -7
- package/Sidebar/DrilldownMenuItem.d.ts +2 -2
- package/Sidebar/DrilldownMenuItem.js +5 -4
- package/Sidebar/ExternalIcon.d.ts +1 -2
- package/Sidebar/ExternalIcon.js +2 -1
- package/Sidebar/Menu.d.ts +1 -2
- package/Sidebar/Menu.js +3 -2
- package/Sidebar/MenuContainer.d.ts +1 -2
- package/Sidebar/MenuContainer.js +2 -1
- package/Sidebar/MenuGroup.d.ts +1 -1
- package/Sidebar/MenuGroup.js +6 -6
- package/Sidebar/MenuItem.d.ts +2 -2
- package/Sidebar/MenuItem.js +7 -6
- package/Sidebar/MenuItemLabel.d.ts +1 -2
- package/Sidebar/MenuItemLabel.js +4 -3
- package/Sidebar/MenuLink.d.ts +1 -2
- package/Sidebar/MenuLink.js +3 -2
- package/Sidebar/MenuLinkItem.d.ts +2 -2
- package/Sidebar/MenuLinkItem.js +4 -3
- package/Sidebar/MobileSidebarButton.d.ts +1 -2
- package/Sidebar/MobileSidebarButton.js +3 -2
- package/Sidebar/Separator.d.ts +2 -2
- package/Sidebar/Separator.js +5 -4
- package/Sidebar/SeparatorItem.d.ts +1 -2
- package/Sidebar/SeparatorItem.js +3 -2
- package/Sidebar/SeparatorLine.d.ts +1 -2
- package/Sidebar/SeparatorLine.js +2 -1
- package/Sidebar/Sidebar.d.ts +2 -2
- package/Sidebar/Sidebar.js +3 -2
- package/Sidebar/SidebarLayout.d.ts +1 -1
- package/Sidebar/SidebarLayout.js +6 -5
- package/Sidebar/index.d.ts +19 -0
- package/Sidebar/index.js +35 -0
- package/Sidebar/types/DrilldownMenuProps.d.ts +2 -2
- package/Sidebar/types/ItemState.d.ts +2 -3
- package/Sidebar/types/MenuItemProps.d.ts +2 -2
- package/Sidebar/types/NavItem.d.ts +1 -1
- package/Sidebar/types/index.d.ts +5 -0
- package/Sidebar/types/index.js +21 -0
- package/SidebarLogo/index.d.ts +1 -1
- package/SidebarLogo/index.js +1 -1
- package/SourceCode/index.d.ts +1 -1
- package/SourceCode/index.js +1 -1
- package/TableOfContent/TableOfContent.d.ts +1 -1
- package/TableOfContent/TableOfContent.js +9 -9
- package/TableOfContent/index.d.ts +1 -0
- package/TableOfContent/index.js +17 -0
- package/Tooltip/index.d.ts +1 -1
- package/Tooltip/index.js +1 -1
- package/globalStyle.d.ts +1 -0
- package/globalStyle.js +7 -3
- package/hooks/index.d.ts +7 -7
- package/hooks/index.js +7 -7
- package/hooks/useActiveSectionId.d.ts +2 -2
- package/hooks/useActiveSectionId.js +1 -0
- package/icons/ShelfIcon/index.d.ts +2 -2
- package/icons/ShelfIcon/index.js +1 -1
- package/icons/index.d.ts +1 -1
- package/icons/index.js +1 -1
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/mocks/Link.js +4 -1
- package/mocks/hooks/usePageData.js +4 -1
- package/package.json +1 -1
- package/src/Button/Button.stories.tsx +1 -1
- package/src/Button/index.ts +1 -1
- package/src/CodeBlock/index.ts +1 -1
- package/src/CopyButton/CopyButton.stories.tsx +1 -1
- package/src/CopyButton/index.ts +2 -2
- package/src/DesignTokens/borders.stories.mdx +20 -0
- package/src/DesignTokens/colors.stories.mdx +24 -0
- package/src/DesignTokens/page-layout.stories.mdx +12 -0
- package/src/DesignTokens/tokens-generated.scss +610 -0
- package/src/DesignTokens/typography.stories.mdx +36 -0
- package/src/Footer/Footer.stories.tsx +57 -0
- package/src/Footer/Footer.tsx +7 -10
- package/src/Footer/FooterColumn.tsx +8 -8
- package/src/Footer/FooterColumns.tsx +5 -3
- package/src/Footer/FooterCopyright.tsx +6 -4
- package/src/Footer/__tests__/Footer.test.tsx +55 -0
- package/src/Footer/__tests__/__snapshots__/Footer.test.tsx.snap +253 -0
- package/src/Footer/index.ts +4 -0
- package/src/Headings/index.ts +1 -1
- package/src/JsonViewer/JsonViewer.stories.tsx +1 -1
- package/src/JsonViewer/index.ts +2 -2
- package/src/Layout/PageLayout.tsx +1 -1
- package/src/Layout/RootLayout.tsx +1 -1
- package/src/Layout/__tests__/PageLayout.test.tsx +17 -0
- package/src/Layout/__tests__/RootLayout.test.tsx +17 -0
- package/src/Layout/__tests__/__snapshots__/PageLayout.test.tsx.snap +38 -0
- package/src/Layout/__tests__/__snapshots__/RootLayout.test.tsx.snap +18 -0
- package/src/Layout/index.ts +2 -0
- package/src/Markdown/{Admonition/Admonition.tsx → Admonition.tsx} +15 -15
- package/src/Markdown/CodeSample/index.ts +3 -0
- package/src/Markdown/{Heading/Heading.tsx → Heading.tsx} +4 -1
- package/src/Markdown/MarkdownLayout.tsx +2 -2
- package/src/Markdown/{Mermaid/Mermaid.tsx → Mermaid.tsx} +0 -0
- package/src/Markdown/StyledMarkdown.tsx +27 -27
- package/src/Markdown/Tabs/index.ts +2 -0
- package/src/Markdown/index.ts +9 -0
- package/src/Navbar/Navbar.stories.tsx +10 -6
- package/src/Navbar/Navbar.tsx +3 -4
- package/src/Navbar/NavbarItem.tsx +2 -2
- package/src/Navbar/NavbarMenu.tsx +3 -3
- package/src/Navbar/__tests__/Navbar.test.tsx +55 -0
- package/src/Navbar/__tests__/__snapshots__/Navbar.test.tsx.snap +256 -0
- package/src/Navbar/index.ts +3 -0
- package/src/NavbarLogo/NavbarLogo.stories.tsx +20 -0
- package/src/NavbarLogo/NavbarLogo.tsx +24 -0
- package/src/NavbarLogo/__tests__/NavbarLogo.test.tsx +47 -0
- package/src/NavbarLogo/__tests__/__snapshots__/NavbarLogo.test.tsx.snap +38 -0
- package/src/NavbarLogo/index.ts +1 -0
- package/src/OperationBadge/OperationBadge.stories.tsx +1 -1
- package/src/OperationBadge/index.ts +1 -1
- package/src/PageNavigation/PageNavigation.stories.tsx +21 -0
- package/src/PageNavigation/__tests__/NextPageLink.test.tsx +29 -0
- package/src/PageNavigation/__tests__/PageNavigation.test.tsx +54 -0
- package/src/PageNavigation/__tests__/PreviousPageLink.test.tsx +29 -0
- package/src/PageNavigation/__tests__/__snapshots__/NextPageLink.test.tsx.snap +67 -0
- package/src/PageNavigation/__tests__/__snapshots__/PageNavigation.test.tsx.snap +275 -0
- package/src/PageNavigation/__tests__/__snapshots__/PreviousPageLink.test.tsx.snap +67 -0
- package/src/PageNavigation/index.ts +3 -0
- package/src/Panel/index.ts +8 -8
- package/src/SamplesPanelControls/SamplesControlButton.stories.tsx +1 -1
- package/src/SamplesPanelControls/index.ts +1 -1
- package/src/Search/Autocomplete.tsx +1 -1
- package/src/Search/ClearIcon.tsx +11 -12
- package/src/Search/Parameters.tsx +2 -2
- package/src/Search/SearchIcon.tsx +11 -12
- package/src/Search/SearchItem.tsx +2 -2
- package/src/Search/__tests__/Input.test.tsx +13 -0
- package/src/Search/__tests__/__snapshots__/Input.test.tsx.snap +36 -0
- package/src/Search/index.ts +9 -0
- package/src/Search/utils.tsx +1 -1
- package/src/Sidebar/ApiCallItem.tsx +5 -5
- package/src/Sidebar/ArrowBack.tsx +1 -1
- package/src/Sidebar/BackButton.tsx +4 -4
- package/src/Sidebar/Drilldown.tsx +6 -6
- package/src/Sidebar/DrilldownMenu.tsx +4 -4
- package/src/Sidebar/DrilldownMenuItem.tsx +6 -6
- package/src/Sidebar/ExternalIcon.tsx +1 -1
- package/src/Sidebar/Menu.tsx +2 -2
- package/src/Sidebar/MenuContainer.tsx +1 -1
- package/src/Sidebar/MenuGroup.tsx +5 -5
- package/src/Sidebar/MenuItem.tsx +6 -6
- package/src/Sidebar/MenuItemLabel.tsx +5 -5
- package/src/Sidebar/MenuLink.tsx +2 -2
- package/src/Sidebar/MenuLinkItem.tsx +3 -3
- package/src/Sidebar/MobileSidebarButton.tsx +3 -3
- package/src/Sidebar/Separator.tsx +4 -4
- package/src/Sidebar/SeparatorItem.tsx +2 -2
- package/src/Sidebar/SeparatorLine.tsx +1 -1
- package/src/Sidebar/Sidebar.tsx +2 -2
- package/src/Sidebar/SidebarLayout.tsx +4 -4
- package/src/Sidebar/index.ts +19 -0
- package/src/Sidebar/types/DrilldownMenuProps.ts +2 -2
- package/src/Sidebar/types/ItemState.ts +2 -4
- package/src/Sidebar/types/MenuItemProps.ts +2 -2
- package/src/Sidebar/types/NavItem.ts +1 -1
- package/src/Sidebar/types/index.ts +5 -0
- package/src/SidebarLogo/SidebarLogo.stories.tsx +1 -1
- package/src/SidebarLogo/index.ts +1 -1
- package/src/SourceCode/SourceCode.stories.tsx +1 -1
- package/src/SourceCode/index.ts +1 -1
- package/src/TableOfContent/TableOfContent.stories.tsx +37 -0
- package/src/TableOfContent/TableOfContent.tsx +13 -11
- package/src/TableOfContent/__tests__/TableOfContent.test.tsx +61 -0
- package/src/TableOfContent/__tests__/__snapshots__/TableOfContent.test.tsx.snap +153 -0
- package/src/TableOfContent/index.ts +1 -0
- package/src/Tooltip/Tooltip.stories.tsx +1 -1
- package/src/Tooltip/index.ts +1 -1
- package/src/Welcome.stories.mdx +7 -0
- package/src/globalStyle.ts +333 -144
- package/src/hooks/index.ts +7 -7
- package/src/hooks/useActiveSectionId.ts +3 -3
- package/src/icons/ShelfIcon/index.ts +2 -2
- package/src/icons/index.ts +1 -1
- package/src/index.ts +1 -0
- package/src/mocks/Link.tsx +5 -2
- package/src/mocks/hooks/usePageData.ts +4 -1
- package/src/types/portal/index.d.ts +0 -1
- package/src/types/portal/src/client/app/Sidebar/types.d.ts +32 -41
- package/src/types/portal/src/client/app/media-css.d.ts +4 -4
- package/src/types/portal/src/client/styling/default.d.ts +585 -391
- package/src/types/portal/src/client/styling/index.d.ts +2 -6
- package/src/types/portal/src/server/constants.d.ts +5 -9
- package/src/types/portal/src/server/plugins/markdown/types.d.ts +14 -19
- package/src/types/portal/src/server/plugins/portal-config/types.d.ts +12 -12
- package/src/types/portal/src/server/plugins/types.d.ts +55 -0
- package/src/types/portal/src/server/store.d.ts +49 -97
- package/src/types/portal/src/server/utils/async.d.ts +1 -5
- package/src/types/portal/src/server/utils/content-provider.d.ts +51 -0
- package/src/types/portal/src/server/utils/index.d.ts +1 -1
- package/src/types/portal/src/server/utils/paths.d.ts +10 -13
- package/src/types/portal/src/server/utils/reporter/formatter.d.ts +8 -8
- package/src/types/portal/src/server/utils/reporter/reporter.d.ts +15 -15
- package/src/types/portal/src/server/version-store.d.ts +35 -0
- package/src/types/portal/src/shared/constants.d.ts +6 -6
- package/src/types/portal/src/shared/types.d.ts +97 -58
- package/src/types/portal/src/shared/urls.d.ts +2 -1
- package/src/ui/AlertIcon.tsx +8 -7
- package/src/ui/{Arrow/Arrow.tsx → Arrow.tsx} +0 -0
- package/src/ui/Background.tsx +3 -3
- package/src/ui/Dropdown.tsx +5 -5
- package/src/ui/Jumbotron.tsx +3 -3
- package/src/ui/Tiles/TileHeader.ts +1 -1
- package/src/ui/Tiles/TileText.tsx +2 -2
- package/src/ui/Tiles/index.ts +4 -0
- package/src/ui/Typography.tsx +22 -22
- package/src/ui/UniversalLink.tsx +2 -2
- package/src/ui/index.tsx +8 -3
- package/src/utils/isUrl.ts +1 -1
- package/src/utils/replaceHashInColor.ts +1 -1
- package/ui/AlertIcon.d.ts +3 -2
- package/ui/AlertIcon.js +2 -2
- package/ui/{Arrow/Arrow.d.ts → Arrow.d.ts} +0 -0
- package/ui/{Arrow/Arrow.js → Arrow.js} +0 -0
- package/ui/Background.js +1 -1
- package/ui/Dropdown.d.ts +1 -1
- package/ui/Dropdown.js +5 -4
- package/ui/Jumbotron.js +3 -3
- package/ui/Tiles/TileHeader.js +1 -1
- package/ui/Tiles/TileText.js +1 -1
- package/ui/Tiles/index.d.ts +4 -0
- package/ui/Tiles/index.js +20 -0
- package/ui/Typography.js +20 -20
- package/ui/UniversalLink.js +4 -4
- package/ui/index.d.ts +7 -3
- package/ui/index.js +7 -3
- package/utils/isUrl.d.ts +1 -1
- package/utils/isUrl.js +2 -1
- package/utils/replaceHashInColor.d.ts +1 -1
- package/utils/replaceHashInColor.js +2 -1
- package/Logo/Logo.d.ts +0 -5
- package/src/Footer/index.tsx +0 -4
- package/src/Introduction.stories.mdx +0 -7
- package/src/Layout/index.tsx +0 -2
- package/src/Logo/Logo.tsx +0 -17
- package/src/types/portal/src/server/plugins/nav-utils.d.ts +0 -19
- package/src/types/portal/src/server/plugins/sidebars/index.d.ts +0 -16
- package/src/types/portal/src/server/plugins/versions/index.d.ts +0 -15
- package/src/types/portal/src/server/plugins/versions/types.d.ts +0 -23
- package/src/types/portal/src/server/plugins/versions/utils.d.ts +0 -10
- package/src/types/portal/src/server/utils/watcher.d.ts +0 -16
|
@@ -18,7 +18,7 @@ export const baseTable = css`
|
|
|
18
18
|
table th,
|
|
19
19
|
table td {
|
|
20
20
|
padding: 12px;
|
|
21
|
-
border-bottom: 1px solid var(--
|
|
21
|
+
border-bottom: 1px solid var(--global-border-color);
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
table th {
|
|
@@ -29,42 +29,42 @@ export const baseTable = css`
|
|
|
29
29
|
|
|
30
30
|
table tr th:first-child,
|
|
31
31
|
table tr td:first-child {
|
|
32
|
-
border-left: 1px solid var(--
|
|
32
|
+
border-left: 1px solid var(--global-border-color);
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
table tr td:last-child,
|
|
36
36
|
table tr th:last-child {
|
|
37
|
-
border-right: 1px solid var(--
|
|
37
|
+
border-right: 1px solid var(--global-border-color);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
table thead td,
|
|
41
41
|
table thead th {
|
|
42
|
-
border-top: 1px solid var(--
|
|
42
|
+
border-top: 1px solid var(--global-border-color);
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
/* top-left border */
|
|
46
46
|
|
|
47
47
|
table thead tr:first-child th:first-child {
|
|
48
|
-
border-top-left-radius: var(--
|
|
48
|
+
border-top-left-radius: var(--panels-border-radius);
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
/* top-right border */
|
|
52
52
|
|
|
53
53
|
table thead tr:first-child th:last-child {
|
|
54
|
-
border-top-right-radius: var(--
|
|
55
|
-
border-top: 1px solid var(--
|
|
54
|
+
border-top-right-radius: var(--panels-border-radius);
|
|
55
|
+
border-top: 1px solid var(--global-border-color);
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
/* bottom-left border */
|
|
59
59
|
|
|
60
60
|
table tbody tr:last-child td:first-child {
|
|
61
|
-
border-bottom-left-radius: var(--
|
|
61
|
+
border-bottom-left-radius: var(--panels-border-radius);
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
/* bottom-right border */
|
|
65
65
|
|
|
66
66
|
table tbody tr:last-child td:last-child {
|
|
67
|
-
border-bottom-right-radius: var(--
|
|
67
|
+
border-bottom-right-radius: var(--panels-border-radius);
|
|
68
68
|
}
|
|
69
69
|
`;
|
|
70
70
|
|
|
@@ -114,21 +114,21 @@ export const StyledMarkdown = styled.main.attrs(() => ({
|
|
|
114
114
|
font-weight: var(--font-weight-regular);
|
|
115
115
|
padding: 0;
|
|
116
116
|
|
|
117
|
-
color: var(--color-
|
|
117
|
+
color: var(--color-content);
|
|
118
118
|
font-size: var(--font-size-base);
|
|
119
|
-
font-family: var(--font-family-
|
|
120
|
-
line-height: var(--line-height-
|
|
119
|
+
font-family: var(--font-family-base);
|
|
120
|
+
line-height: var(--line-height-base);
|
|
121
121
|
|
|
122
122
|
a:not([role='button']) {
|
|
123
|
-
text-decoration: var(--
|
|
124
|
-
color: var(--
|
|
123
|
+
text-decoration: var(--link-decoration);
|
|
124
|
+
color: var(--link-color);
|
|
125
125
|
|
|
126
126
|
&:visited {
|
|
127
|
-
color: var(--
|
|
127
|
+
color: var(--link-color);
|
|
128
128
|
}
|
|
129
129
|
|
|
130
130
|
&:hover {
|
|
131
|
-
color: var(--
|
|
131
|
+
color: var(--link-color-hover);
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
134
|
|
|
@@ -142,8 +142,8 @@ export const StyledMarkdown = styled.main.attrs(() => ({
|
|
|
142
142
|
h4,
|
|
143
143
|
h5,
|
|
144
144
|
h6 {
|
|
145
|
-
font-weight: var(--font-weight
|
|
146
|
-
font-family: var(--font-family
|
|
145
|
+
font-weight: var(--h-font-weight);
|
|
146
|
+
font-family: var(--h-font-family);
|
|
147
147
|
position: relative;
|
|
148
148
|
|
|
149
149
|
scroll-margin-top: 60px;
|
|
@@ -154,14 +154,14 @@ export const StyledMarkdown = styled.main.attrs(() => ({
|
|
|
154
154
|
}
|
|
155
155
|
|
|
156
156
|
hr {
|
|
157
|
-
border-top: 1px solid var(--
|
|
157
|
+
border-top: 1px solid var(--global-border-color);
|
|
158
158
|
}
|
|
159
159
|
|
|
160
160
|
details {
|
|
161
161
|
margin: 1.125em 0;
|
|
162
162
|
|
|
163
163
|
summary {
|
|
164
|
-
color: var(--color-
|
|
164
|
+
color: var(--color-content);
|
|
165
165
|
font-weight: var(--font-weight-regular);
|
|
166
166
|
outline: 0;
|
|
167
167
|
padding: 0;
|
|
@@ -183,17 +183,17 @@ export const StyledMarkdown = styled.main.attrs(() => ({
|
|
|
183
183
|
.snippets-tabs-headers {
|
|
184
184
|
font-size: 0.9em;
|
|
185
185
|
|
|
186
|
-
font-family: var(--font-family
|
|
186
|
+
font-family: var(--h-font-family);
|
|
187
187
|
|
|
188
188
|
.tab-header {
|
|
189
189
|
text-align: center;
|
|
190
190
|
padding: 0.2em 0.5em;
|
|
191
191
|
display: inline-block;
|
|
192
192
|
cursor: pointer;
|
|
193
|
-
color: var(--color-
|
|
193
|
+
color: var(--color-content-secondary);
|
|
194
194
|
|
|
195
195
|
&.active {
|
|
196
|
-
color: var(--color
|
|
196
|
+
color: var(--h-color);
|
|
197
197
|
font-weight: var(--font-weight-bold);
|
|
198
198
|
}
|
|
199
199
|
}
|
|
@@ -260,11 +260,11 @@ export const StyledMarkdown = styled.main.attrs(() => ({
|
|
|
260
260
|
}
|
|
261
261
|
|
|
262
262
|
code {
|
|
263
|
-
color: var(--code-color);
|
|
264
|
-
background-color: var(--code-background-color);
|
|
263
|
+
color: var(--inline-code-color);
|
|
264
|
+
background-color: var(--inline-code-background-color);
|
|
265
265
|
|
|
266
266
|
border-radius: 2px;
|
|
267
|
-
border: 1px solid var(--
|
|
267
|
+
border: 1px solid var(--global-border-color);
|
|
268
268
|
padding: 0.1em 0.25em 0.2em;
|
|
269
269
|
font-weight: var(--code-font-weight);
|
|
270
270
|
word-break: break-word;
|
|
@@ -275,7 +275,7 @@ export const StyledMarkdown = styled.main.attrs(() => ({
|
|
|
275
275
|
blockquote {
|
|
276
276
|
margin: var(--bloquote-margin-vertical) var(--bloquote-margin-horizontal);
|
|
277
277
|
padding: var(--bloquote-padding-vertical) var(--bloquote-padding-horizontal);
|
|
278
|
-
border-left: 4px solid var(--
|
|
278
|
+
border-left: 4px solid var(--global-border-color);
|
|
279
279
|
background-color: var(--bloquote-background-color);
|
|
280
280
|
|
|
281
281
|
${typography(typographyTokens.blockquote)};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from '@theme/Markdown/CodeSample';
|
|
2
|
+
export * from '@theme/Markdown/Tabs';
|
|
3
|
+
export * from '@theme/Markdown/Admonition';
|
|
4
|
+
export * from '@theme/Markdown/ContentWrapper';
|
|
5
|
+
export * from '@theme/Markdown/Heading';
|
|
6
|
+
export * from '@theme/Markdown/MarkdownLayout';
|
|
7
|
+
export * from '@theme/Markdown/Mermaid';
|
|
8
|
+
export * from '@theme/Markdown/PageWrapper';
|
|
9
|
+
export * from '@theme/Markdown/StyledMarkdown';
|
|
@@ -1,21 +1,25 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ComponentStory, ComponentMeta } from '@storybook/react';
|
|
3
3
|
|
|
4
|
-
import Navbar from './Navbar';
|
|
5
|
-
import NavbarMenu from './NavbarMenu';
|
|
4
|
+
import { Navbar } from './Navbar';
|
|
5
|
+
import { NavbarMenu } from './NavbarMenu';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { NavbarLogo } from '@theme/NavbarLogo/NavbarLogo';
|
|
8
8
|
|
|
9
9
|
export default {
|
|
10
|
-
title: 'Navbar',
|
|
10
|
+
title: 'Components/Navbar',
|
|
11
11
|
component: Navbar,
|
|
12
12
|
} as ComponentMeta<typeof Navbar>;
|
|
13
13
|
|
|
14
|
-
const Template: ComponentStory<typeof Navbar> = (args) => <Navbar {...args}
|
|
14
|
+
const Template: ComponentStory<typeof Navbar> = (args) => <Navbar {...args} />;
|
|
15
15
|
|
|
16
16
|
export const Main = Template.bind({});
|
|
17
17
|
Main.args = {
|
|
18
|
-
logo:
|
|
18
|
+
logo: (
|
|
19
|
+
<NavbarLogo
|
|
20
|
+
logo={{ link: '/test/', image: 'https://picsum.photos/id/2/400/100', altText: 'test' }}
|
|
21
|
+
/>
|
|
22
|
+
),
|
|
19
23
|
menu: (
|
|
20
24
|
<NavbarMenu
|
|
21
25
|
menuItems={[
|
package/src/Navbar/Navbar.tsx
CHANGED
|
@@ -5,10 +5,9 @@ interface NavbarProps {
|
|
|
5
5
|
menu: React.ReactNode;
|
|
6
6
|
logo: React.ReactNode;
|
|
7
7
|
search: React.ReactNode;
|
|
8
|
-
theme: any;
|
|
9
8
|
}
|
|
10
9
|
|
|
11
|
-
export
|
|
10
|
+
export function Navbar({ menu, logo, search }: NavbarProps): JSX.Element {
|
|
12
11
|
return (
|
|
13
12
|
<NavbarContainer data-component-name="Navbar/Navbar">
|
|
14
13
|
{logo}
|
|
@@ -22,7 +21,7 @@ export const NavbarContainer = styled.nav`
|
|
|
22
21
|
height: var(--navbar-height);
|
|
23
22
|
box-sizing: border-box;
|
|
24
23
|
display: flex;
|
|
25
|
-
color: var(--navbar-color
|
|
24
|
+
color: var(--navbar-text-color);
|
|
26
25
|
align-items: center;
|
|
27
26
|
justify-content: space-between;
|
|
28
27
|
flex-shrink: 0;
|
|
@@ -32,7 +31,7 @@ export const NavbarContainer = styled.nav`
|
|
|
32
31
|
top: 0;
|
|
33
32
|
z-index: 200;
|
|
34
33
|
padding: 10px var(--sidebar-margin-left);
|
|
35
|
-
background: var(--navbar-color
|
|
34
|
+
background: var(--navbar-background-color);
|
|
36
35
|
font-family: var(--h-font-family);
|
|
37
36
|
|
|
38
37
|
${({ theme }) => theme.mediaQueries.medium} {
|
|
@@ -51,7 +51,7 @@ interface NavbarItemProps {
|
|
|
51
51
|
navItem: ResolvedNavLinkItem;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
export
|
|
54
|
+
export function NavbarItem({ navItem }: NavbarItemProps): JSX.Element {
|
|
55
55
|
const { pathname } = useLocation();
|
|
56
56
|
const isActive = pathname === withPathPrefix(navItem.link);
|
|
57
57
|
|
|
@@ -79,7 +79,7 @@ const NavMenuItem = styled.li<{ active?: boolean }>`
|
|
|
79
79
|
|
|
80
80
|
const NavLink = styled(Link)`
|
|
81
81
|
color: ${({ active }) =>
|
|
82
|
-
active ? 'var(--navbar-item-active-text-color)' : 'var(--navbar-color
|
|
82
|
+
active ? 'var(--navbar-item-active-text-color)' : 'var(--navbar-text-color)'};
|
|
83
83
|
text-decoration: ${({ active }) =>
|
|
84
84
|
active ? 'var(--navbar-item-active-text-decoration)' : 'none'};
|
|
85
85
|
`;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
|
|
4
|
-
import NavbarItem from '@theme/Navbar/NavbarItem';
|
|
4
|
+
import { NavbarItem } from '@theme/Navbar/NavbarItem';
|
|
5
5
|
|
|
6
|
-
export
|
|
7
|
-
if (!menuItems
|
|
6
|
+
export function NavbarMenu({ menuItems }: { menuItems: any[] }): JSX.Element | null {
|
|
7
|
+
if (!menuItems?.length) {
|
|
8
8
|
return null;
|
|
9
9
|
}
|
|
10
10
|
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { renderWithTheme } from '../../../tests/utils';
|
|
4
|
+
|
|
5
|
+
import { Navbar, NavbarMenu } from '@theme/Navbar';
|
|
6
|
+
import { NavbarLogo } from '@theme/NavbarLogo';
|
|
7
|
+
|
|
8
|
+
jest.mock('react-router-dom', () => {
|
|
9
|
+
const originalModule = jest.requireActual('react-router-dom');
|
|
10
|
+
return {
|
|
11
|
+
__esModule: true,
|
|
12
|
+
...originalModule,
|
|
13
|
+
useLocation: jest.fn().mockReturnValue({ pathname: '/' }),
|
|
14
|
+
};
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
describe('Navbar', () => {
|
|
18
|
+
it('renders', () => {
|
|
19
|
+
const { container } = renderWithTheme(
|
|
20
|
+
<Navbar
|
|
21
|
+
logo={
|
|
22
|
+
<NavbarLogo
|
|
23
|
+
logo={{ link: '/test/', image: 'https://picsum.photos/id/2/400/100', altText: 'test' }}
|
|
24
|
+
/>
|
|
25
|
+
}
|
|
26
|
+
menu={
|
|
27
|
+
<NavbarMenu
|
|
28
|
+
menuItems={[
|
|
29
|
+
{ type: 'link', link: 'https://google.com', label: 'Google' },
|
|
30
|
+
{ type: 'link', link: '/', label: 'Test' },
|
|
31
|
+
]}
|
|
32
|
+
/>
|
|
33
|
+
}
|
|
34
|
+
search={<span> Search </span>}
|
|
35
|
+
/>,
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
expect(container.firstChild).toMatchSnapshot();
|
|
39
|
+
});
|
|
40
|
+
it('renders with empty menu items', () => {
|
|
41
|
+
const { container } = renderWithTheme(
|
|
42
|
+
<Navbar
|
|
43
|
+
logo={
|
|
44
|
+
<NavbarLogo
|
|
45
|
+
logo={{ link: '/test/', image: 'https://picsum.photos/id/2/400/100', altText: 'test' }}
|
|
46
|
+
/>
|
|
47
|
+
}
|
|
48
|
+
menu={<NavbarMenu menuItems={[]} />}
|
|
49
|
+
search={<span> Search </span>}
|
|
50
|
+
/>,
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
expect(container.firstChild).toMatchSnapshot();
|
|
54
|
+
});
|
|
55
|
+
});
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`Navbar renders 1`] = `
|
|
4
|
+
.c0 {
|
|
5
|
+
height: var(--navbar-height);
|
|
6
|
+
box-sizing: border-box;
|
|
7
|
+
display: -webkit-box;
|
|
8
|
+
display: -webkit-flex;
|
|
9
|
+
display: -ms-flexbox;
|
|
10
|
+
display: flex;
|
|
11
|
+
color: var(--navbar-text-color);
|
|
12
|
+
-webkit-align-items: center;
|
|
13
|
+
-webkit-box-align: center;
|
|
14
|
+
-ms-flex-align: center;
|
|
15
|
+
align-items: center;
|
|
16
|
+
-webkit-box-pack: justify;
|
|
17
|
+
-webkit-justify-content: space-between;
|
|
18
|
+
-ms-flex-pack: justify;
|
|
19
|
+
justify-content: space-between;
|
|
20
|
+
-webkit-flex-shrink: 0;
|
|
21
|
+
-ms-flex-negative: 0;
|
|
22
|
+
flex-shrink: 0;
|
|
23
|
+
font-size: 0.875rem;
|
|
24
|
+
position: -webkit-sticky;
|
|
25
|
+
position: sticky;
|
|
26
|
+
top: 0;
|
|
27
|
+
z-index: 200;
|
|
28
|
+
padding: 10px var(--sidebar-margin-left);
|
|
29
|
+
background: var(--navbar-background-color);
|
|
30
|
+
font-family: var(--h-font-family);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.c3 {
|
|
34
|
+
display: inline-block;
|
|
35
|
+
padding: 20px calc(var(--sidebar-spacing-horizontal) * 2);
|
|
36
|
+
text-align: center;
|
|
37
|
+
line-height: 1;
|
|
38
|
+
font-size: var(--navbar-item-font-size);
|
|
39
|
+
margin-left: var(--navbar-item-margin-horizontal);
|
|
40
|
+
margin-right: var(--navbar-item-margin-horizontal);
|
|
41
|
+
border-radius: var(--navbar-item-border-radius);
|
|
42
|
+
font-weight: var(--navbar-item-font-weight);
|
|
43
|
+
background: none;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.c6 {
|
|
47
|
+
display: inline-block;
|
|
48
|
+
padding: 20px calc(var(--sidebar-spacing-horizontal) * 2);
|
|
49
|
+
text-align: center;
|
|
50
|
+
line-height: 1;
|
|
51
|
+
font-size: var(--navbar-item-font-size);
|
|
52
|
+
margin-left: var(--navbar-item-margin-horizontal);
|
|
53
|
+
margin-right: var(--navbar-item-margin-horizontal);
|
|
54
|
+
border-radius: var(--navbar-item-border-radius);
|
|
55
|
+
font-weight: var(--navbar-item-font-weight);
|
|
56
|
+
background: var(--navbar-item-active-background-color);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.c4 {
|
|
60
|
+
color: var(--navbar-text-color);
|
|
61
|
+
-webkit-text-decoration: none;
|
|
62
|
+
text-decoration: none;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.c7 {
|
|
66
|
+
color: var(--navbar-item-active-text-color);
|
|
67
|
+
-webkit-text-decoration: var(--navbar-item-active-text-decoration);
|
|
68
|
+
text-decoration: var(--navbar-item-active-text-decoration);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.c5 {
|
|
72
|
+
cursor: pointer;
|
|
73
|
+
vertical-align: middle;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.c2 {
|
|
77
|
+
list-style: none;
|
|
78
|
+
margin: 0;
|
|
79
|
+
padding: 0;
|
|
80
|
+
display: block;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.c1 {
|
|
84
|
+
max-width: var(--logo-max-width);
|
|
85
|
+
max-height: var(--logo-max-height);
|
|
86
|
+
height: var(--logo-height);
|
|
87
|
+
margin: var(--logo-margin);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
@media screen and (min-width:85rem) {
|
|
91
|
+
.c0 {
|
|
92
|
+
padding: 10px var(--sidebar-margin-left);
|
|
93
|
+
font-size: 1rem;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
@media print {
|
|
98
|
+
.c0 {
|
|
99
|
+
background: transparent;
|
|
100
|
+
display: none;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.c0 > :not(a,img) {
|
|
104
|
+
display: none !important;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.c0 img {
|
|
108
|
+
padding: 0;
|
|
109
|
+
margin: 0;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
@media screen and (min-width:85rem) {
|
|
114
|
+
.c2 {
|
|
115
|
+
display: block;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
<nav
|
|
120
|
+
class="c0"
|
|
121
|
+
data-component-name="Navbar/Navbar"
|
|
122
|
+
>
|
|
123
|
+
<a
|
|
124
|
+
href="/test/"
|
|
125
|
+
to="/test/"
|
|
126
|
+
>
|
|
127
|
+
<img
|
|
128
|
+
alt="test"
|
|
129
|
+
class="c1"
|
|
130
|
+
data-component-name="NavbarLogo/NavbarLogo"
|
|
131
|
+
src="https://picsum.photos/id/2/400/100"
|
|
132
|
+
/>
|
|
133
|
+
</a>
|
|
134
|
+
<ul
|
|
135
|
+
class="c2"
|
|
136
|
+
data-component-name="Navbar/NavbarMenu"
|
|
137
|
+
>
|
|
138
|
+
<li
|
|
139
|
+
class="c3"
|
|
140
|
+
data-component-name="Navbar/NavbarItem"
|
|
141
|
+
>
|
|
142
|
+
<a
|
|
143
|
+
class="c4"
|
|
144
|
+
href="https://google.com"
|
|
145
|
+
to="https://google.com"
|
|
146
|
+
>
|
|
147
|
+
<span
|
|
148
|
+
class="c5"
|
|
149
|
+
>
|
|
150
|
+
Google
|
|
151
|
+
</span>
|
|
152
|
+
</a>
|
|
153
|
+
</li>
|
|
154
|
+
<li
|
|
155
|
+
class="c6"
|
|
156
|
+
data-component-name="Navbar/NavbarItem"
|
|
157
|
+
>
|
|
158
|
+
<a
|
|
159
|
+
class="c7"
|
|
160
|
+
href="/"
|
|
161
|
+
to="/"
|
|
162
|
+
>
|
|
163
|
+
<span
|
|
164
|
+
class="c5"
|
|
165
|
+
>
|
|
166
|
+
Test
|
|
167
|
+
</span>
|
|
168
|
+
</a>
|
|
169
|
+
</li>
|
|
170
|
+
</ul>
|
|
171
|
+
<span>
|
|
172
|
+
Search
|
|
173
|
+
</span>
|
|
174
|
+
</nav>
|
|
175
|
+
`;
|
|
176
|
+
|
|
177
|
+
exports[`Navbar renders with empty menu items 1`] = `
|
|
178
|
+
.c0 {
|
|
179
|
+
height: var(--navbar-height);
|
|
180
|
+
box-sizing: border-box;
|
|
181
|
+
display: -webkit-box;
|
|
182
|
+
display: -webkit-flex;
|
|
183
|
+
display: -ms-flexbox;
|
|
184
|
+
display: flex;
|
|
185
|
+
color: var(--navbar-text-color);
|
|
186
|
+
-webkit-align-items: center;
|
|
187
|
+
-webkit-box-align: center;
|
|
188
|
+
-ms-flex-align: center;
|
|
189
|
+
align-items: center;
|
|
190
|
+
-webkit-box-pack: justify;
|
|
191
|
+
-webkit-justify-content: space-between;
|
|
192
|
+
-ms-flex-pack: justify;
|
|
193
|
+
justify-content: space-between;
|
|
194
|
+
-webkit-flex-shrink: 0;
|
|
195
|
+
-ms-flex-negative: 0;
|
|
196
|
+
flex-shrink: 0;
|
|
197
|
+
font-size: 0.875rem;
|
|
198
|
+
position: -webkit-sticky;
|
|
199
|
+
position: sticky;
|
|
200
|
+
top: 0;
|
|
201
|
+
z-index: 200;
|
|
202
|
+
padding: 10px var(--sidebar-margin-left);
|
|
203
|
+
background: var(--navbar-background-color);
|
|
204
|
+
font-family: var(--h-font-family);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
.c1 {
|
|
208
|
+
max-width: var(--logo-max-width);
|
|
209
|
+
max-height: var(--logo-max-height);
|
|
210
|
+
height: var(--logo-height);
|
|
211
|
+
margin: var(--logo-margin);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
@media screen and (min-width:85rem) {
|
|
215
|
+
.c0 {
|
|
216
|
+
padding: 10px var(--sidebar-margin-left);
|
|
217
|
+
font-size: 1rem;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
@media print {
|
|
222
|
+
.c0 {
|
|
223
|
+
background: transparent;
|
|
224
|
+
display: none;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
.c0 > :not(a,img) {
|
|
228
|
+
display: none !important;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
.c0 img {
|
|
232
|
+
padding: 0;
|
|
233
|
+
margin: 0;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
<nav
|
|
238
|
+
class="c0"
|
|
239
|
+
data-component-name="Navbar/Navbar"
|
|
240
|
+
>
|
|
241
|
+
<a
|
|
242
|
+
href="/test/"
|
|
243
|
+
to="/test/"
|
|
244
|
+
>
|
|
245
|
+
<img
|
|
246
|
+
alt="test"
|
|
247
|
+
class="c1"
|
|
248
|
+
data-component-name="NavbarLogo/NavbarLogo"
|
|
249
|
+
src="https://picsum.photos/id/2/400/100"
|
|
250
|
+
/>
|
|
251
|
+
</a>
|
|
252
|
+
<span>
|
|
253
|
+
Search
|
|
254
|
+
</span>
|
|
255
|
+
</nav>
|
|
256
|
+
`;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ComponentStory, ComponentMeta } from '@storybook/react';
|
|
3
|
+
|
|
4
|
+
import { NavbarLogo } from '@theme/NavbarLogo/NavbarLogo';
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: 'Portal/NavbarLogo',
|
|
8
|
+
component: NavbarLogo,
|
|
9
|
+
} as ComponentMeta<typeof NavbarLogo>;
|
|
10
|
+
|
|
11
|
+
const Template: ComponentStory<typeof NavbarLogo> = (args) => <NavbarLogo {...args} />;
|
|
12
|
+
|
|
13
|
+
export const Default = Template.bind({});
|
|
14
|
+
Default.args = {
|
|
15
|
+
logo: {
|
|
16
|
+
image: 'https://redocly.github.io/redoc/petstore-logo.png',
|
|
17
|
+
link: 'http://redocly.com/',
|
|
18
|
+
altText: 'Pet Store',
|
|
19
|
+
},
|
|
20
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
import { Link } from '@portal/Link';
|
|
5
|
+
import { LogoConfig } from '@theme/types/portal';
|
|
6
|
+
|
|
7
|
+
export type NavbarLogoProps = { logo: Pick<LogoConfig, 'image' | 'link' | 'altText'> };
|
|
8
|
+
|
|
9
|
+
export function NavbarLogo({ logo }: NavbarLogoProps): JSX.Element | null {
|
|
10
|
+
if (!logo.image) {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
const img = (
|
|
14
|
+
<NavLogo src={logo.image} alt={logo.altText} data-component-name="NavbarLogo/NavbarLogo" />
|
|
15
|
+
);
|
|
16
|
+
return logo.link ? <Link to={logo.link}>{img}</Link> : img;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const NavLogo = styled.img`
|
|
20
|
+
max-width: var(--logo-max-width);
|
|
21
|
+
max-height: var(--logo-max-height);
|
|
22
|
+
height: var(--logo-height);
|
|
23
|
+
margin: var(--logo-margin);
|
|
24
|
+
`;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { renderWithTheme } from '../../../tests/utils';
|
|
4
|
+
|
|
5
|
+
import { NavbarLogo } from '@theme/NavbarLogo';
|
|
6
|
+
|
|
7
|
+
describe('NavbarLogo', () => {
|
|
8
|
+
it('renders', () => {
|
|
9
|
+
const { container } = renderWithTheme(
|
|
10
|
+
<NavbarLogo
|
|
11
|
+
logo={{
|
|
12
|
+
image: 'https://test.com/logo.png',
|
|
13
|
+
altText: 'Navbar Logo',
|
|
14
|
+
link: 'https://test.com/',
|
|
15
|
+
}}
|
|
16
|
+
/>,
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
expect(container.firstChild).toMatchSnapshot();
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('renders without link', () => {
|
|
23
|
+
const { container } = renderWithTheme(
|
|
24
|
+
<NavbarLogo
|
|
25
|
+
logo={{
|
|
26
|
+
image: 'https://test.com/logo.png',
|
|
27
|
+
altText: 'Navbar Logo',
|
|
28
|
+
}}
|
|
29
|
+
/>,
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
expect(container.firstChild).toMatchSnapshot();
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it('renders nothing, if no image provided', () => {
|
|
36
|
+
const { container } = renderWithTheme(
|
|
37
|
+
<NavbarLogo
|
|
38
|
+
logo={{
|
|
39
|
+
altText: 'Navbar Logo',
|
|
40
|
+
link: 'https://test.com/',
|
|
41
|
+
}}
|
|
42
|
+
/>,
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
expect(container.firstChild).toBeNull();
|
|
46
|
+
});
|
|
47
|
+
});
|