@redocly/theme 0.1.9 → 0.1.10

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.
Files changed (204) hide show
  1. package/Button/index.d.ts +1 -1
  2. package/Button/index.js +1 -1
  3. package/CodeBlock/index.d.ts +1 -1
  4. package/CodeBlock/index.js +1 -1
  5. package/CopyButton/index.d.ts +2 -2
  6. package/CopyButton/index.js +2 -2
  7. package/Footer/Footer.d.ts +2 -2
  8. package/Footer/Footer.js +1 -1
  9. package/Footer/FooterColumn.js +6 -6
  10. package/Footer/FooterColumns.d.ts +3 -3
  11. package/Footer/FooterCopyright.d.ts +3 -3
  12. package/Footer/FooterCopyright.js +1 -1
  13. package/Footer/index.d.ts +4 -4
  14. package/Footer/index.js +4 -4
  15. package/Headings/index.d.ts +1 -1
  16. package/Headings/index.js +1 -1
  17. package/JsonViewer/index.d.ts +2 -2
  18. package/JsonViewer/index.js +2 -2
  19. package/Layout/index.d.ts +2 -2
  20. package/Layout/index.js +2 -2
  21. package/Markdown/Admonition.js +4 -4
  22. package/Markdown/CodeSample/index.d.ts +3 -3
  23. package/Markdown/CodeSample/index.js +3 -3
  24. package/Markdown/Heading.js +1 -1
  25. package/Markdown/MarkdownLayout.d.ts +2 -2
  26. package/Markdown/StyledMarkdown.js +2 -2
  27. package/Markdown/Tabs/index.d.ts +2 -2
  28. package/Markdown/Tabs/index.js +2 -2
  29. package/Markdown/index.d.ts +9 -9
  30. package/Markdown/index.js +9 -9
  31. package/Navbar/Navbar.d.ts +0 -1
  32. package/Navbar/Navbar.js +1 -1
  33. package/Navbar/NavbarItem.js +1 -1
  34. package/Navbar/index.d.ts +3 -0
  35. package/Navbar/index.js +19 -0
  36. package/NavbarLogo/NavbarLogo.d.ts +6 -0
  37. package/{Logo/Logo.js → NavbarLogo/NavbarLogo.js} +8 -5
  38. package/NavbarLogo/index.d.ts +1 -0
  39. package/{Logo → NavbarLogo}/index.js +1 -1
  40. package/OperationBadge/index.d.ts +1 -1
  41. package/OperationBadge/index.js +1 -1
  42. package/PageNavigation/index.d.ts +3 -0
  43. package/PageNavigation/index.js +19 -0
  44. package/Panel/index.d.ts +8 -8
  45. package/Panel/index.js +8 -8
  46. package/REAMDE.md +1 -0
  47. package/SamplesPanelControls/index.d.ts +1 -1
  48. package/SamplesPanelControls/index.js +1 -1
  49. package/Search/Autocomplete.js +1 -1
  50. package/Search/Parameters.js +2 -2
  51. package/Search/SearchItem.js +2 -2
  52. package/Search/index.d.ts +9 -9
  53. package/Search/index.js +9 -9
  54. package/Search/utils.js +1 -1
  55. package/Sidebar/BackButton.js +1 -1
  56. package/Sidebar/DrilldownMenuItem.js +3 -3
  57. package/Sidebar/Menu.js +1 -1
  58. package/Sidebar/MenuItemLabel.js +2 -2
  59. package/Sidebar/MenuLink.js +1 -1
  60. package/Sidebar/MobileSidebarButton.js +1 -1
  61. package/Sidebar/Sidebar.js +1 -1
  62. package/Sidebar/index.d.ts +19 -19
  63. package/Sidebar/index.js +19 -19
  64. package/Sidebar/types/index.d.ts +5 -5
  65. package/Sidebar/types/index.js +5 -5
  66. package/SidebarLogo/index.d.ts +1 -1
  67. package/SidebarLogo/index.js +1 -1
  68. package/SourceCode/index.d.ts +1 -1
  69. package/SourceCode/index.js +1 -1
  70. package/TableOfContent/TableOfContent.js +3 -3
  71. package/TableOfContent/index.d.ts +1 -1
  72. package/TableOfContent/index.js +1 -1
  73. package/Tooltip/index.d.ts +1 -1
  74. package/Tooltip/index.js +1 -1
  75. package/globalStyle.js +1 -1
  76. package/hooks/index.d.ts +7 -7
  77. package/hooks/index.js +7 -7
  78. package/hooks/useActiveSectionId.d.ts +2 -2
  79. package/hooks/useActiveSectionId.js +1 -0
  80. package/icons/ShelfIcon/index.d.ts +2 -2
  81. package/icons/ShelfIcon/index.js +1 -1
  82. package/icons/index.d.ts +1 -1
  83. package/icons/index.js +1 -1
  84. package/package.json +1 -1
  85. package/src/Button/Button.stories.tsx +1 -1
  86. package/src/Button/index.ts +1 -1
  87. package/src/CodeBlock/index.ts +1 -1
  88. package/src/CopyButton/CopyButton.stories.tsx +1 -1
  89. package/src/CopyButton/index.ts +2 -2
  90. package/src/Footer/Footer.stories.tsx +57 -0
  91. package/src/Footer/Footer.tsx +5 -8
  92. package/src/Footer/FooterColumn.tsx +7 -7
  93. package/src/Footer/FooterColumns.tsx +3 -1
  94. package/src/Footer/FooterCopyright.tsx +5 -3
  95. package/src/Footer/__tests__/Footer.test.tsx +55 -0
  96. package/src/Footer/__tests__/__snapshots__/Footer.test.tsx.snap +253 -0
  97. package/src/Footer/index.ts +4 -4
  98. package/src/Headings/index.ts +1 -1
  99. package/src/JsonViewer/JsonViewer.stories.tsx +1 -1
  100. package/src/JsonViewer/index.ts +2 -2
  101. package/src/Layout/__tests__/PageLayout.test.tsx +17 -0
  102. package/src/Layout/__tests__/RootLayout.test.tsx +17 -0
  103. package/src/Layout/__tests__/__snapshots__/PageLayout.test.tsx.snap +38 -0
  104. package/src/Layout/__tests__/__snapshots__/RootLayout.test.tsx.snap +18 -0
  105. package/src/Layout/index.ts +2 -2
  106. package/src/Markdown/Admonition.tsx +15 -15
  107. package/src/Markdown/CodeSample/index.ts +3 -3
  108. package/src/Markdown/Heading.tsx +4 -1
  109. package/src/Markdown/MarkdownLayout.tsx +2 -2
  110. package/src/Markdown/StyledMarkdown.tsx +27 -27
  111. package/src/Markdown/Tabs/index.ts +2 -2
  112. package/src/Markdown/index.ts +9 -9
  113. package/src/Navbar/Navbar.stories.tsx +7 -3
  114. package/src/Navbar/Navbar.tsx +2 -3
  115. package/src/Navbar/NavbarItem.tsx +1 -1
  116. package/src/Navbar/index.ts +3 -0
  117. package/src/NavbarLogo/NavbarLogo.stories.tsx +20 -0
  118. package/src/NavbarLogo/NavbarLogo.tsx +24 -0
  119. package/src/NavbarLogo/__tests__/NavbarLogo.test.tsx +47 -0
  120. package/src/NavbarLogo/__tests__/__snapshots__/NavbarLogo.test.tsx.snap +38 -0
  121. package/src/NavbarLogo/index.ts +1 -0
  122. package/src/OperationBadge/OperationBadge.stories.tsx +1 -1
  123. package/src/OperationBadge/index.ts +1 -1
  124. package/src/PageNavigation/index.ts +3 -0
  125. package/src/Panel/index.ts +8 -8
  126. package/src/SamplesPanelControls/SamplesControlButton.stories.tsx +1 -1
  127. package/src/SamplesPanelControls/index.ts +1 -1
  128. package/src/Search/Autocomplete.tsx +1 -1
  129. package/src/Search/Parameters.tsx +2 -2
  130. package/src/Search/SearchItem.tsx +2 -2
  131. package/src/Search/index.ts +9 -9
  132. package/src/Search/utils.tsx +1 -1
  133. package/src/Sidebar/BackButton.tsx +2 -2
  134. package/src/Sidebar/DrilldownMenuItem.tsx +4 -4
  135. package/src/Sidebar/Menu.tsx +1 -1
  136. package/src/Sidebar/MenuItemLabel.tsx +4 -4
  137. package/src/Sidebar/MenuLink.tsx +1 -1
  138. package/src/Sidebar/MobileSidebarButton.tsx +2 -2
  139. package/src/Sidebar/Sidebar.tsx +1 -1
  140. package/src/Sidebar/index.ts +19 -19
  141. package/src/Sidebar/types/index.ts +5 -5
  142. package/src/SidebarLogo/SidebarLogo.stories.tsx +1 -1
  143. package/src/SidebarLogo/index.ts +1 -1
  144. package/src/SourceCode/SourceCode.stories.tsx +1 -1
  145. package/src/SourceCode/index.ts +1 -1
  146. package/src/TableOfContent/TableOfContent.tsx +6 -6
  147. package/src/TableOfContent/index.ts +1 -1
  148. package/src/Tooltip/Tooltip.stories.tsx +1 -1
  149. package/src/Tooltip/index.ts +1 -1
  150. package/src/Welcome.stories.mdx +7 -0
  151. package/src/globalStyle.ts +102 -7
  152. package/src/hooks/index.ts +7 -7
  153. package/src/hooks/useActiveSectionId.ts +3 -3
  154. package/src/icons/ShelfIcon/index.ts +2 -2
  155. package/src/icons/index.ts +1 -1
  156. package/src/types/portal/index.d.ts +0 -1
  157. package/src/types/portal/src/client/app/Sidebar/types.d.ts +32 -41
  158. package/src/types/portal/src/client/app/media-css.d.ts +4 -4
  159. package/src/types/portal/src/client/styling/default.d.ts +585 -391
  160. package/src/types/portal/src/client/styling/index.d.ts +2 -6
  161. package/src/types/portal/src/server/constants.d.ts +5 -9
  162. package/src/types/portal/src/server/plugins/markdown/types.d.ts +14 -19
  163. package/src/types/portal/src/server/plugins/portal-config/types.d.ts +12 -12
  164. package/src/types/portal/src/server/plugins/types.d.ts +55 -0
  165. package/src/types/portal/src/server/store.d.ts +49 -97
  166. package/src/types/portal/src/server/utils/async.d.ts +1 -5
  167. package/src/types/portal/src/server/utils/content-provider.d.ts +51 -0
  168. package/src/types/portal/src/server/utils/index.d.ts +1 -1
  169. package/src/types/portal/src/server/utils/paths.d.ts +10 -13
  170. package/src/types/portal/src/server/utils/reporter/formatter.d.ts +8 -8
  171. package/src/types/portal/src/server/utils/reporter/reporter.d.ts +15 -15
  172. package/src/types/portal/src/server/version-store.d.ts +35 -0
  173. package/src/types/portal/src/shared/constants.d.ts +6 -6
  174. package/src/types/portal/src/shared/types.d.ts +97 -58
  175. package/src/types/portal/src/shared/urls.d.ts +2 -1
  176. package/src/ui/AlertIcon.tsx +8 -7
  177. package/src/ui/Background.tsx +3 -3
  178. package/src/ui/Dropdown.tsx +4 -4
  179. package/src/ui/Jumbotron.tsx +3 -3
  180. package/src/ui/Tiles/TileHeader.ts +1 -1
  181. package/src/ui/Tiles/TileText.tsx +2 -2
  182. package/src/ui/Tiles/index.ts +4 -4
  183. package/src/ui/Typography.tsx +22 -22
  184. package/ui/AlertIcon.d.ts +3 -2
  185. package/ui/AlertIcon.js +2 -2
  186. package/ui/Background.js +1 -1
  187. package/ui/Dropdown.js +3 -3
  188. package/ui/Jumbotron.js +3 -3
  189. package/ui/Tiles/TileHeader.js +1 -1
  190. package/ui/Tiles/TileText.js +1 -1
  191. package/ui/Tiles/index.d.ts +4 -4
  192. package/ui/Tiles/index.js +4 -4
  193. package/ui/Typography.js +20 -20
  194. package/Logo/Logo.d.ts +0 -5
  195. package/Logo/index.d.ts +0 -1
  196. package/src/Introduction.stories.mdx +0 -7
  197. package/src/Logo/Logo.tsx +0 -17
  198. package/src/Logo/index.ts +0 -1
  199. package/src/types/portal/src/server/plugins/nav-utils.d.ts +0 -19
  200. package/src/types/portal/src/server/plugins/sidebars/index.d.ts +0 -16
  201. package/src/types/portal/src/server/plugins/versions/index.d.ts +0 -15
  202. package/src/types/portal/src/server/plugins/versions/types.d.ts +0 -23
  203. package/src/types/portal/src/server/plugins/versions/utils.d.ts +0 -10
  204. package/src/types/portal/src/server/utils/watcher.d.ts +0 -16
package/hooks/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- export * from './useControl';
2
- export * from './useMount';
3
- export * from './useUnmount';
4
- export * from './useActiveHeading';
5
- export * from './useActiveSectionId';
6
- export * from './useFullHeight';
7
- export * from './useNavbarHeight';
1
+ export * from '../hooks/useControl';
2
+ export * from '../hooks/useMount';
3
+ export * from '../hooks/useUnmount';
4
+ export * from '../hooks/useActiveHeading';
5
+ export * from '../hooks/useActiveSectionId';
6
+ export * from '../hooks/useFullHeight';
7
+ export * from '../hooks/useNavbarHeight';
package/hooks/index.js CHANGED
@@ -14,10 +14,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./useControl"), exports);
18
- __exportStar(require("./useMount"), exports);
19
- __exportStar(require("./useUnmount"), exports);
20
- __exportStar(require("./useActiveHeading"), exports);
21
- __exportStar(require("./useActiveSectionId"), exports);
22
- __exportStar(require("./useFullHeight"), exports);
23
- __exportStar(require("./useNavbarHeight"), exports);
17
+ __exportStar(require("../hooks/useControl"), exports);
18
+ __exportStar(require("../hooks/useMount"), exports);
19
+ __exportStar(require("../hooks/useUnmount"), exports);
20
+ __exportStar(require("../hooks/useActiveHeading"), exports);
21
+ __exportStar(require("../hooks/useActiveSectionId"), exports);
22
+ __exportStar(require("../hooks/useFullHeight"), exports);
23
+ __exportStar(require("../hooks/useNavbarHeight"), exports);
@@ -1,3 +1,3 @@
1
- import type { MenuProps } from '@theme/types/portal';
1
+ import { Location } from 'history';
2
2
  export declare type UseActiveSectionIdReturnType = string;
3
- export declare function useActiveSectionId(location: MenuProps['location'], hasOverviewPage: boolean): UseActiveSectionIdReturnType;
3
+ export declare function useActiveSectionId(location: Location, hasOverviewPage?: boolean): UseActiveSectionIdReturnType;
@@ -8,6 +8,7 @@ var react_1 = require("react");
8
8
  var lodash_throttle_1 = __importDefault(require("lodash.throttle"));
9
9
  var useNavbarHeight_1 = require("../hooks/useNavbarHeight");
10
10
  function useActiveSectionId(location, hasOverviewPage) {
11
+ if (hasOverviewPage === void 0) { hasOverviewPage = false; }
11
12
  var _a = (0, react_1.useState)(''), itemId = _a[0], setItemId = _a[1];
12
13
  var navbarHeight = (0, useNavbarHeight_1.useNavbarHeight)(location);
13
14
  var scrollListener = (0, react_1.useMemo)(function () {
@@ -1,2 +1,2 @@
1
- export { ShelfIcon } from './ShelfIcon';
2
- export type { ShelfIconProps } from './ShelfIcon';
1
+ export { ShelfIcon } from '../../icons/ShelfIcon/ShelfIcon';
2
+ export type { ShelfIconProps } from '../../icons/ShelfIcon/ShelfIcon';
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ShelfIcon = void 0;
4
- var ShelfIcon_1 = require("./ShelfIcon");
4
+ var ShelfIcon_1 = require("../../icons/ShelfIcon/ShelfIcon");
5
5
  Object.defineProperty(exports, "ShelfIcon", { enumerable: true, get: function () { return ShelfIcon_1.ShelfIcon; } });
package/icons/index.d.ts CHANGED
@@ -1 +1 @@
1
- export * from './ShelfIcon';
1
+ export * from '../icons/ShelfIcon';
package/icons/index.js CHANGED
@@ -14,4 +14,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./ShelfIcon"), exports);
17
+ __exportStar(require("../icons/ShelfIcon"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redocly/theme",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "description": "Shared UI components",
5
5
  "author": "team@redocly.com",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -4,7 +4,7 @@ import { ComponentStory, ComponentMeta } from '@storybook/react';
4
4
  import { Button } from '@theme/Button';
5
5
 
6
6
  export default {
7
- title: 'Button',
7
+ title: 'Components/Button',
8
8
  component: Button,
9
9
  argTypes: {
10
10
  size: {
@@ -1 +1 @@
1
- export * from './Button';
1
+ export * from '@theme/Button/Button';
@@ -1 +1 @@
1
- export * from './CodeBlock';
1
+ export * from '@theme/CodeBlock/CodeBlock';
@@ -4,7 +4,7 @@ import { ComponentStory, ComponentMeta } from '@storybook/react';
4
4
  import { CopyButton } from '@theme/CopyButton';
5
5
 
6
6
  export default {
7
- title: 'CopyButton',
7
+ title: 'Components/CopyButton',
8
8
  component: CopyButton,
9
9
  } as ComponentMeta<typeof CopyButton>;
10
10
 
@@ -1,2 +1,2 @@
1
- export * from './CopyButtonWrapper';
2
- export * from './CopyButton';
1
+ export * from '@theme/CopyButton/CopyButtonWrapper';
2
+ export * from '@theme/CopyButton/CopyButton';
@@ -0,0 +1,57 @@
1
+ import React from 'react';
2
+ import { ComponentMeta, ComponentStory } from '@storybook/react';
3
+
4
+ import { Footer } from '@theme/Footer';
5
+
6
+ export default {
7
+ title: 'Portal/Footer',
8
+ component: Footer,
9
+ } as ComponentMeta<typeof Footer>;
10
+
11
+ const Template: ComponentStory<typeof Footer> = (args) => <Footer {...args} />;
12
+
13
+ export const WithCopyrightOnly = Template.bind({});
14
+ WithCopyrightOnly.args = {
15
+ copyrightText: 'Redocly ®',
16
+ };
17
+
18
+ export const WithColumns = Template.bind({});
19
+ WithColumns.args = {
20
+ copyrightText: 'Redocly ®',
21
+ columns: [
22
+ {
23
+ group: 'Products',
24
+ items: [
25
+ { label: 'Portal', active: true, type: 'link', link: 'https://redocly.com/portals/' },
26
+ { label: 'Workflows', type: 'link', link: 'https://redocly.com/workflows/' },
27
+ { label: 'Redocly CLI', type: 'link', link: 'https://redocly.com/redocly-cli/' },
28
+ ],
29
+ },
30
+ {
31
+ group: 'Explore',
32
+ items: [
33
+ { label: 'Pricing', type: 'link', link: 'https://redocly.com/pricing/' },
34
+ { label: 'Enterprise', type: 'link', link: 'https://redocly.com/enterprise/' },
35
+ { label: 'Customers', type: 'link', link: 'https://redocly.com/customers/' },
36
+ ],
37
+ },
38
+ {
39
+ group: 'Resources',
40
+ items: [
41
+ { label: 'Docs', type: 'link', link: 'https://redocly.com/docs/' },
42
+ { label: 'Blog', type: 'link', link: 'https://redocly.com/blog/' },
43
+ { label: 'Webinars', type: 'link', link: 'https://redocly.com/webinars/' },
44
+ { label: 'Error link', type: 'error' },
45
+ ],
46
+ },
47
+ {
48
+ group: 'Other',
49
+ items: [
50
+ { label: 'External', type: 'link', link: 'https://google.com/', external: true },
51
+ { type: 'separator', separatorLine: true },
52
+ { label: 'Twitter', type: 'link', link: 'https://twitter.com/' },
53
+ { label: 'Error link', type: 'error' },
54
+ ],
55
+ },
56
+ ],
57
+ };
@@ -5,10 +5,7 @@ import { FooterColumns } from '@theme/Footer/FooterColumns';
5
5
  import { FooterCopyright } from '@theme/Footer/FooterCopyright';
6
6
  import type { FooterConfig } from '@theme/types/portal';
7
7
 
8
- export function Footer({
9
- columns,
10
- copyrightText,
11
- }: React.PropsWithChildren<FooterConfig>): JSX.Element | null {
8
+ export function Footer({ columns, copyrightText }: FooterConfig): JSX.Element | null {
12
9
  if (!(columns?.length || copyrightText)) {
13
10
  return null;
14
11
  }
@@ -24,11 +21,11 @@ export function Footer({
24
21
  const FooterContainer = styled.footer`
25
22
  font-size: 1rem;
26
23
  flex-shrink: 0;
27
- background-color: var(--footer-color-background);
28
- color: var(--footer-color-text);
29
- font-family: var(--font-family-primary);
24
+ background-color: var(--footer-background-color);
25
+ color: var(--footer-text-color);
26
+ font-family: var(--font-family-base);
30
27
  a,
31
28
  a:hover {
32
- color: var(--footer-color-text);
29
+ color: var(--footer-text-color);
33
30
  }
34
31
  `;
@@ -12,17 +12,17 @@ export function FooterColumn({ column }: FooterColumnProps): JSX.Element {
12
12
  return (
13
13
  <FooterColumnContainer data-component-name="Footer/FooterColumn">
14
14
  <FooterColumnTitle>{column.group || column.label}</FooterColumnTitle>
15
- {column.items.map((columnItem, columnItemInex) => {
15
+ {column.items.map((columnItem, columnItemIndex) => {
16
16
  if (columnItem.type === 'error') {
17
17
  return null;
18
18
  }
19
19
 
20
20
  return columnItem.type === 'separator' ? (
21
- <FooterSeparator key={columnItem.label + '_' + columnItemInex}>
21
+ <FooterSeparator key={columnItem.label + '_' + columnItemIndex}>
22
22
  {columnItem.label}
23
23
  </FooterSeparator>
24
24
  ) : (
25
- <FooterLink key={columnItemInex} to={columnItem.link} data-cy={columnItem.label}>
25
+ <FooterLink key={columnItemIndex} to={columnItem.link} data-cy={columnItem.label}>
26
26
  {columnItem.label}
27
27
  </FooterLink>
28
28
  );
@@ -36,7 +36,7 @@ const FooterColumnTitle = styled.p`
36
36
  font-weight: var(--font-weight-regular);
37
37
  font-size: 24px;
38
38
  margin-bottom: 1.5em;
39
- font-family: var(--font-family-h);
39
+ font-family: var(--h-font-family);
40
40
  `;
41
41
 
42
42
  const FooterSeparator = styled.div`
@@ -44,19 +44,19 @@ const FooterSeparator = styled.div`
44
44
  margin: 10px 0 5px 0;
45
45
  font-size: 0.75em;
46
46
  text-transform: uppercase;
47
- font-family: var(--font-family-h);
47
+ font-family: var(--h-font-family);
48
48
  `;
49
49
 
50
50
  const FooterColumnContainer = styled.div`
51
51
  display: flex;
52
52
  flex-direction: column;
53
53
  text-align: left;
54
- margin: 0px 30px;
54
+ margin: 0 30px;
55
55
  `;
56
56
 
57
57
  const FooterLink = styled(Link)`
58
58
  font-weight: var(--font-weight-bold);
59
59
  padding-bottom: 0.75em;
60
- color: var(--footer-color-text);
60
+ color: var(--footer-text-color);
61
61
  text-decoration: none;
62
62
  `;
@@ -6,7 +6,9 @@ import type { FooterConfig } from '@theme/types/portal';
6
6
 
7
7
  export function FooterColumns({
8
8
  columns = [],
9
- }: React.PropsWithChildren<{ columns?: FooterConfig['columns'] }>): JSX.Element | null {
9
+ }: {
10
+ columns?: FooterConfig['columns'];
11
+ }): JSX.Element | null {
10
12
  if (!columns?.length) {
11
13
  return null;
12
14
  }
@@ -5,7 +5,9 @@ import type { FooterConfig } from '@theme/types/portal';
5
5
 
6
6
  export function FooterCopyright({
7
7
  copyrightText = '',
8
- }: React.PropsWithChildren<{ copyrightText?: FooterConfig['copyrightText'] }>): JSX.Element | null {
8
+ }: {
9
+ copyrightText?: FooterConfig['copyrightText'];
10
+ }): JSX.Element | null {
9
11
  return copyrightText ? (
10
12
  <Wrapper data-component-name="Footer/FooterCopyright">{copyrightText}</Wrapper>
11
13
  ) : null;
@@ -17,8 +19,8 @@ const Wrapper = styled.section`
17
19
  font-size: 0.875em;
18
20
  padding: 1.5em 3em;
19
21
  font-weight: var(--font-weight-bold);
20
- background-color: var(--footer-color-background);
21
- color: var(--footer-color-text);
22
+ background-color: var(--footer-background-color);
23
+ color: var(--footer-text-color);
22
24
  text-align: center;
23
25
  span {
24
26
  max-width: 1200px;
@@ -0,0 +1,55 @@
1
+ import React from 'react';
2
+
3
+ import { renderWithTheme } from '../../../tests/utils';
4
+
5
+ import { Footer } from '@theme/Footer';
6
+
7
+ describe('Footer', () => {
8
+ it('renders columns with copyright and columns', () => {
9
+ const { container } = renderWithTheme(
10
+ <Footer
11
+ columns={[
12
+ {
13
+ group: 'Other',
14
+ items: [
15
+ { label: 'External', type: 'link', link: 'https://google.com/' },
16
+ { type: 'separator', separatorLine: true },
17
+ { label: 'Twitter', type: 'link', link: 'https://twitter.com/' },
18
+ { label: 'Error link', type: 'error' },
19
+ ],
20
+ },
21
+ {
22
+ group: '',
23
+ label: 'Another',
24
+ items: [
25
+ { type: 'separator', separatorLine: true },
26
+ { label: 'Twitter', type: 'link', link: 'https://twitter.com/' },
27
+ { label: 'Error link', type: 'error' },
28
+ ],
29
+ },
30
+ ]}
31
+ copyrightText="Copyright®"
32
+ />,
33
+ );
34
+
35
+ expect(container.firstChild).toMatchSnapshot();
36
+ });
37
+
38
+ it('renders columns with copyright only', () => {
39
+ const { container } = renderWithTheme(<Footer copyrightText="Copyright®" />);
40
+
41
+ expect(container.firstChild).toMatchSnapshot();
42
+ });
43
+
44
+ it('renders nothing, if no columns and copyright provided', () => {
45
+ const { container } = renderWithTheme(<Footer />);
46
+
47
+ expect(container.firstChild).toMatchSnapshot();
48
+ });
49
+
50
+ it('renders nothing, if empty columns and copyright provided', () => {
51
+ const { container } = renderWithTheme(<Footer columns={[]} />);
52
+
53
+ expect(container.firstChild).toMatchSnapshot();
54
+ });
55
+ });
@@ -0,0 +1,253 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`Footer renders columns with copyright and columns 1`] = `
4
+ .c4 {
5
+ display: inline-block;
6
+ font-weight: var(--font-weight-regular);
7
+ font-size: 24px;
8
+ margin-bottom: 1.5em;
9
+ font-family: var(--h-font-family);
10
+ }
11
+
12
+ .c6 {
13
+ opacity: 0.75;
14
+ margin: 10px 0 5px 0;
15
+ font-size: 0.75em;
16
+ text-transform: uppercase;
17
+ font-family: var(--h-font-family);
18
+ }
19
+
20
+ .c3 {
21
+ display: -webkit-box;
22
+ display: -webkit-flex;
23
+ display: -ms-flexbox;
24
+ display: flex;
25
+ -webkit-flex-direction: column;
26
+ -ms-flex-direction: column;
27
+ flex-direction: column;
28
+ text-align: left;
29
+ margin: 0 30px;
30
+ }
31
+
32
+ .c5 {
33
+ font-weight: var(--font-weight-bold);
34
+ padding-bottom: 0.75em;
35
+ color: var(--footer-text-color);
36
+ -webkit-text-decoration: none;
37
+ text-decoration: none;
38
+ }
39
+
40
+ .c1 {
41
+ padding: 3em 20px 1em 20px;
42
+ display: -webkit-box;
43
+ display: -webkit-flex;
44
+ display: -ms-flexbox;
45
+ display: flex;
46
+ -webkit-flex-direction: column;
47
+ -ms-flex-direction: column;
48
+ flex-direction: column;
49
+ -webkit-box-pack: center;
50
+ -webkit-justify-content: center;
51
+ -ms-flex-pack: center;
52
+ justify-content: center;
53
+ max-width: 1200px;
54
+ margin: 0 auto;
55
+ }
56
+
57
+ .c2 {
58
+ display: -webkit-box;
59
+ display: -webkit-flex;
60
+ display: -ms-flexbox;
61
+ display: flex;
62
+ -webkit-flex-wrap: wrap;
63
+ -ms-flex-wrap: wrap;
64
+ flex-wrap: wrap;
65
+ -webkit-box-pack: start;
66
+ -webkit-justify-content: flex-start;
67
+ -ms-flex-pack: start;
68
+ justify-content: flex-start;
69
+ }
70
+
71
+ .c7 {
72
+ display: -webkit-box;
73
+ display: -webkit-flex;
74
+ display: -ms-flexbox;
75
+ display: flex;
76
+ -webkit-box-pack: center;
77
+ -webkit-justify-content: center;
78
+ -ms-flex-pack: center;
79
+ justify-content: center;
80
+ font-size: 0.875em;
81
+ padding: 1.5em 3em;
82
+ font-weight: var(--font-weight-bold);
83
+ background-color: var(--footer-background-color);
84
+ color: var(--footer-text-color);
85
+ text-align: center;
86
+ }
87
+
88
+ .c7 span {
89
+ max-width: 1200px;
90
+ }
91
+
92
+ .c0 {
93
+ font-size: 1rem;
94
+ -webkit-flex-shrink: 0;
95
+ -ms-flex-negative: 0;
96
+ flex-shrink: 0;
97
+ background-color: var(--footer-background-color);
98
+ color: var(--footer-text-color);
99
+ font-family: var(--font-family-base);
100
+ }
101
+
102
+ .c0 a,
103
+ .c0 a:hover {
104
+ color: var(--footer-text-color);
105
+ }
106
+
107
+ @media screen and (min-width:50rem) {
108
+ .c1 {
109
+ padding: 5.625em 20px 3.9375em 20px;
110
+ }
111
+ }
112
+
113
+ @media print {
114
+ .c1 {
115
+ color: black;
116
+ display: none;
117
+ }
118
+ }
119
+
120
+ @media screen and (min-width:50rem) {
121
+ .c2 {
122
+ -webkit-box-pack: space-evenly;
123
+ -webkit-justify-content: space-evenly;
124
+ -ms-flex-pack: space-evenly;
125
+ justify-content: space-evenly;
126
+ }
127
+ }
128
+
129
+ <footer
130
+ class="c0"
131
+ data-component-name="Footer/Footer"
132
+ >
133
+ <div
134
+ class="c1"
135
+ data-component-name="Footer/FooterColumns"
136
+ >
137
+ <div
138
+ class="c2"
139
+ >
140
+ <div
141
+ class="c3"
142
+ data-component-name="Footer/FooterColumn"
143
+ >
144
+ <p
145
+ class="c4"
146
+ >
147
+ Other
148
+ </p>
149
+ <a
150
+ class="c5"
151
+ data-cy="External"
152
+ href="https://google.com/"
153
+ to="https://google.com/"
154
+ >
155
+ External
156
+ </a>
157
+ <div
158
+ class="c6"
159
+ />
160
+ <a
161
+ class="c5"
162
+ data-cy="Twitter"
163
+ href="https://twitter.com/"
164
+ to="https://twitter.com/"
165
+ >
166
+ Twitter
167
+ </a>
168
+ </div>
169
+ <div
170
+ class="c3"
171
+ data-component-name="Footer/FooterColumn"
172
+ >
173
+ <p
174
+ class="c4"
175
+ >
176
+ Another
177
+ </p>
178
+ <div
179
+ class="c6"
180
+ />
181
+ <a
182
+ class="c5"
183
+ data-cy="Twitter"
184
+ href="https://twitter.com/"
185
+ to="https://twitter.com/"
186
+ >
187
+ Twitter
188
+ </a>
189
+ </div>
190
+ </div>
191
+ </div>
192
+ <section
193
+ class="c7"
194
+ data-component-name="Footer/FooterCopyright"
195
+ >
196
+ Copyright®
197
+ </section>
198
+ </footer>
199
+ `;
200
+
201
+ exports[`Footer renders columns with copyright only 1`] = `
202
+ .c1 {
203
+ display: -webkit-box;
204
+ display: -webkit-flex;
205
+ display: -ms-flexbox;
206
+ display: flex;
207
+ -webkit-box-pack: center;
208
+ -webkit-justify-content: center;
209
+ -ms-flex-pack: center;
210
+ justify-content: center;
211
+ font-size: 0.875em;
212
+ padding: 1.5em 3em;
213
+ font-weight: var(--font-weight-bold);
214
+ background-color: var(--footer-background-color);
215
+ color: var(--footer-text-color);
216
+ text-align: center;
217
+ }
218
+
219
+ .c1 span {
220
+ max-width: 1200px;
221
+ }
222
+
223
+ .c0 {
224
+ font-size: 1rem;
225
+ -webkit-flex-shrink: 0;
226
+ -ms-flex-negative: 0;
227
+ flex-shrink: 0;
228
+ background-color: var(--footer-background-color);
229
+ color: var(--footer-text-color);
230
+ font-family: var(--font-family-base);
231
+ }
232
+
233
+ .c0 a,
234
+ .c0 a:hover {
235
+ color: var(--footer-text-color);
236
+ }
237
+
238
+ <footer
239
+ class="c0"
240
+ data-component-name="Footer/Footer"
241
+ >
242
+ <section
243
+ class="c1"
244
+ data-component-name="Footer/FooterCopyright"
245
+ >
246
+ Copyright®
247
+ </section>
248
+ </footer>
249
+ `;
250
+
251
+ exports[`Footer renders nothing, if empty columns and copyright provided 1`] = `null`;
252
+
253
+ exports[`Footer renders nothing, if no columns and copyright provided 1`] = `null`;
@@ -1,4 +1,4 @@
1
- export * from './Footer';
2
- export * from './FooterColumn';
3
- export * from './FooterColumns';
4
- export * from './FooterCopyright';
1
+ export * from '@theme/Footer/Footer';
2
+ export * from '@theme/Footer/FooterColumn';
3
+ export * from '@theme/Footer/FooterColumns';
4
+ export * from '@theme/Footer/FooterCopyright';
@@ -1 +1 @@
1
- export * from './Headings';
1
+ export * from '@theme/Headings/Headings';
@@ -4,7 +4,7 @@ import { ComponentStory, ComponentMeta } from '@storybook/react';
4
4
  import { JsonViewer } from '@theme/JsonViewer';
5
5
 
6
6
  export default {
7
- title: 'JsonViewer',
7
+ title: 'Components/JsonViewer',
8
8
  component: JsonViewer,
9
9
  } as ComponentMeta<typeof JsonViewer>;
10
10
 
@@ -1,2 +1,2 @@
1
- export * from './JsonViewer';
2
- export * from './styled';
1
+ export * from '@theme/JsonViewer/JsonViewer';
2
+ export * from '@theme/JsonViewer/styled';
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+
3
+ import { renderWithTheme } from '../../../tests/utils';
4
+
5
+ import { PageLayout } from '@theme/Layout/PageLayout';
6
+
7
+ describe('PageLayout', () => {
8
+ it('renders', () => {
9
+ const { container } = renderWithTheme(
10
+ <PageLayout sidebar={<div>sidebar</div>}>
11
+ <div>test content</div>
12
+ </PageLayout>,
13
+ );
14
+
15
+ expect(container.firstChild).toMatchSnapshot();
16
+ });
17
+ });
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+
3
+ import { renderWithTheme } from '../../../tests/utils';
4
+
5
+ import { RootLayout } from '@theme/Layout/RootLayout';
6
+
7
+ describe('RootLayout', () => {
8
+ it('renders', () => {
9
+ const { container } = renderWithTheme(
10
+ <RootLayout footer={<div>footer</div>} navbar={<div>navbar</div>}>
11
+ <div>content</div>
12
+ </RootLayout>,
13
+ );
14
+
15
+ expect(container.firstChild).toMatchSnapshot();
16
+ });
17
+ });