@redocly/theme 0.1.20 → 0.1.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/Button/Button.d.ts +4 -3
  2. package/Button/Button.js +28 -1
  3. package/JsonViewer/JsonViewer.js +1 -2
  4. package/JsonViewer/index.d.ts +0 -1
  5. package/JsonViewer/index.js +0 -1
  6. package/Markdown/Admonition.js +1 -1
  7. package/Markdown/CodeSample/CodeSample.js +15 -5
  8. package/Markdown/CodeSample/index.d.ts +0 -1
  9. package/Markdown/CodeSample/index.js +0 -1
  10. package/Navbar/Navbar.js +7 -1
  11. package/PageNavigation/NextPageLink.js +8 -5
  12. package/PageNavigation/PreviousPageLink.js +8 -5
  13. package/Search/SidebarSearch.d.ts +2 -0
  14. package/Search/SidebarSearch.js +15 -0
  15. package/Sidebar/MenuGroup.js +2 -2
  16. package/Sidebar/SidebarLayout.js +5 -0
  17. package/TableOfContent/TableOfContent.js +8 -1
  18. package/Typography/CompactTypography.d.ts +11 -0
  19. package/Typography/CompactTypography.js +18 -0
  20. package/Typography/Emphasis.d.ts +3 -0
  21. package/Typography/Emphasis.js +15 -0
  22. package/Typography/H1.d.ts +3 -0
  23. package/Typography/H1.js +16 -0
  24. package/Typography/H2.d.ts +3 -0
  25. package/Typography/H2.js +16 -0
  26. package/Typography/H3.d.ts +3 -0
  27. package/Typography/H3.js +16 -0
  28. package/Typography/SectionHeader.d.ts +1 -0
  29. package/Typography/SectionHeader.js +13 -0
  30. package/Typography/Typography.d.ts +8 -0
  31. package/Typography/Typography.js +22 -0
  32. package/Typography/index.d.ts +7 -0
  33. package/{Headings → Typography}/index.js +7 -1
  34. package/{ui → icons/AlertIcon}/AlertIcon.d.ts +2 -2
  35. package/{ui → icons/AlertIcon}/AlertIcon.js +1 -1
  36. package/icons/AlertIcon/index.d.ts +2 -0
  37. package/icons/AlertIcon/index.js +5 -0
  38. package/icons/ArrowIcon/ArrowIcon.d.ts +7 -0
  39. package/{ui/Arrow.js → icons/ArrowIcon/ArrowIcon.js} +3 -3
  40. package/icons/ArrowIcon/index.d.ts +2 -0
  41. package/icons/ArrowIcon/index.js +5 -0
  42. package/icons/index.d.ts +2 -0
  43. package/icons/index.js +2 -0
  44. package/index.d.ts +1 -1
  45. package/index.js +1 -1
  46. package/mocks/constants/index.d.ts +2 -0
  47. package/mocks/constants/index.js +5 -0
  48. package/mocks/hooks/index.d.ts +6 -0
  49. package/mocks/hooks/index.js +16 -0
  50. package/package.json +1 -1
  51. package/settings.yaml +9 -0
  52. package/src/Button/Button.tsx +19 -1
  53. package/src/JsonViewer/JsonViewer.tsx +106 -2
  54. package/src/JsonViewer/index.ts +0 -1
  55. package/src/Markdown/Admonition.tsx +1 -1
  56. package/src/Markdown/CodeSample/CodeSample.tsx +160 -6
  57. package/src/Markdown/CodeSample/index.ts +0 -1
  58. package/src/Navbar/Navbar.tsx +8 -1
  59. package/src/PageNavigation/NextPageLink.tsx +9 -3
  60. package/src/PageNavigation/PreviousPageLink.tsx +9 -3
  61. package/src/Search/SidebarSearch.tsx +13 -0
  62. package/src/Sidebar/MenuGroup.tsx +2 -2
  63. package/src/Sidebar/SidebarLayout.tsx +5 -0
  64. package/src/TableOfContent/TableOfContent.tsx +7 -1
  65. package/src/Typography/CompactTypography.ts +9 -0
  66. package/src/Typography/Emphasis.ts +7 -0
  67. package/src/Typography/H1.ts +12 -0
  68. package/src/Typography/H2.ts +12 -0
  69. package/src/Typography/H3.ts +11 -0
  70. package/src/Typography/SectionHeader.ts +11 -0
  71. package/src/Typography/Typography.ts +21 -0
  72. package/src/Typography/index.ts +7 -0
  73. package/src/{ui → icons/AlertIcon}/AlertIcon.tsx +3 -3
  74. package/src/icons/AlertIcon/index.ts +2 -0
  75. package/src/{ui/Arrow.tsx → icons/ArrowIcon/ArrowIcon.tsx} +5 -5
  76. package/src/icons/ArrowIcon/index.ts +2 -0
  77. package/src/icons/index.ts +2 -0
  78. package/src/index.ts +1 -1
  79. package/src/mocks/constants/index.ts +2 -0
  80. package/src/mocks/hooks/index.ts +17 -0
  81. package/src/ui/Jumbotron.tsx +1 -1
  82. package/src/ui/index.tsx +0 -4
  83. package/ui/Jumbotron.js +1 -1
  84. package/ui/index.d.ts +0 -4
  85. package/ui/index.js +0 -4
  86. package/Headings/Headings.d.ts +0 -3
  87. package/Headings/Headings.js +0 -16
  88. package/Headings/index.d.ts +0 -1
  89. package/JsonViewer/styled.d.ts +0 -1
  90. package/JsonViewer/styled.js +0 -10
  91. package/Markdown/CodeSample/styled.d.ts +0 -4
  92. package/Markdown/CodeSample/styled.js +0 -85
  93. package/src/Headings/Headings.ts +0 -23
  94. package/src/Headings/index.ts +0 -1
  95. package/src/JsonViewer/styled.ts +0 -110
  96. package/src/Markdown/CodeSample/styled.ts +0 -209
  97. package/src/ui/Button.tsx +0 -19
  98. package/src/ui/Typography.tsx +0 -90
  99. package/ui/Arrow.d.ts +0 -7
  100. package/ui/Button.d.ts +0 -7
  101. package/ui/Button.js +0 -30
  102. package/ui/Typography.d.ts +0 -41
  103. package/ui/Typography.js +0 -59
@@ -7,7 +7,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
7
7
  return (mod && mod.__esModule) ? mod : { "default": mod };
8
8
  };
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.Arrow = void 0;
10
+ exports.ArrowIcon = void 0;
11
11
  var react_1 = __importDefault(require("react"));
12
12
  var styled_components_1 = __importDefault(require("styled-components"));
13
13
  function directionToTransform(_a) {
@@ -25,9 +25,9 @@ function directionToTransform(_a) {
25
25
  }
26
26
  var Icon = function (_a) {
27
27
  var className = _a.className;
28
- return (react_1.default.createElement("span", { "data-component-name": "ui/Arrow/Arrow" },
28
+ return (react_1.default.createElement("span", { "data-component-name": "icons/ArrowIcon/ArrowIcon" },
29
29
  react_1.default.createElement("svg", { fill: "none", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 7 5", className: className },
30
30
  react_1.default.createElement("path", { d: "M3.5 2.51L5.806.205a.7.7 0 01.99.99l-2.8 2.8a.698.698 0 01-.99 0l-2.8-2.8a.7.7 0 11.99-.99L3.5 2.51z" }))));
31
31
  };
32
- exports.Arrow = (0, styled_components_1.default)(Icon)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n width: var(--sidebar-chevron-size);\n height: var(--sidebar-chevron-size);\n fill: var(--sidebar-chevron-color);\n transform: rotate(", "deg);\n\n vertical-align: middle;\n"], ["\n width: var(--sidebar-chevron-size);\n height: var(--sidebar-chevron-size);\n fill: var(--sidebar-chevron-color);\n transform: rotate(", "deg);\n\n vertical-align: middle;\n"])), directionToTransform);
32
+ exports.ArrowIcon = (0, styled_components_1.default)(Icon)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n width: var(--sidebar-chevron-size);\n height: var(--sidebar-chevron-size);\n fill: var(--sidebar-chevron-color);\n transform: rotate(", "deg);\n\n vertical-align: middle;\n"], ["\n width: var(--sidebar-chevron-size);\n height: var(--sidebar-chevron-size);\n fill: var(--sidebar-chevron-color);\n transform: rotate(", "deg);\n\n vertical-align: middle;\n"])), directionToTransform);
33
33
  var templateObject_1;
@@ -0,0 +1,2 @@
1
+ export { ArrowIcon } from '../../icons/ArrowIcon/ArrowIcon';
2
+ export type { ArrowIconProps } from '../../icons/ArrowIcon/ArrowIcon';
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ArrowIcon = void 0;
4
+ var ArrowIcon_1 = require("../../icons/ArrowIcon/ArrowIcon");
5
+ Object.defineProperty(exports, "ArrowIcon", { enumerable: true, get: function () { return ArrowIcon_1.ArrowIcon; } });
package/icons/index.d.ts CHANGED
@@ -1 +1,3 @@
1
1
  export * from '../icons/ShelfIcon';
2
+ export * from '../icons/AlertIcon';
3
+ export * from '../icons/ArrowIcon';
package/icons/index.js CHANGED
@@ -15,3 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("../icons/ShelfIcon"), exports);
18
+ __exportStar(require("../icons/AlertIcon"), exports);
19
+ __exportStar(require("../icons/ArrowIcon"), exports);
package/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export * from './Button';
2
2
  export * from './CopyButton';
3
3
  export * from './JsonViewer';
4
- export * from './Headings';
4
+ export * from './Typography';
5
5
  export * from './SidebarLogo';
6
6
  export * from './CodeBlock';
7
7
  export * from './SamplesPanelControls';
package/index.js CHANGED
@@ -17,7 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./Button"), exports);
18
18
  __exportStar(require("./CopyButton"), exports);
19
19
  __exportStar(require("./JsonViewer"), exports);
20
- __exportStar(require("./Headings"), exports);
20
+ __exportStar(require("./Typography"), exports);
21
21
  __exportStar(require("./SidebarLogo"), exports);
22
22
  __exportStar(require("./CodeBlock"), exports);
23
23
  __exportStar(require("./SamplesPanelControls"), exports);
@@ -0,0 +1,2 @@
1
+ export declare const DEFAULT_THEME_NAME = "@redocly/theme";
2
+ export declare const USER_THEME_ALIAS = "@theme";
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.USER_THEME_ALIAS = exports.DEFAULT_THEME_NAME = void 0;
4
+ exports.DEFAULT_THEME_NAME = '@redocly/theme';
5
+ exports.USER_THEME_ALIAS = '@theme';
@@ -0,0 +1,6 @@
1
+ interface RawTheme {
2
+ name: string;
3
+ settings?: any;
4
+ }
5
+ export declare function useThemeSettings(name: string): RawTheme['settings'];
6
+ export {};
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useThemeSettings = void 0;
4
+ function useThemeSettings(name) {
5
+ return {
6
+ name: name,
7
+ settings: {
8
+ toc: { header: 'header', hide: false },
9
+ navigation: {
10
+ nextPageLink: { label: 'next page' },
11
+ previousPageLink: { label: 'prev page' },
12
+ },
13
+ },
14
+ };
15
+ }
16
+ exports.useThemeSettings = useThemeSettings;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redocly/theme",
3
- "version": "0.1.20",
3
+ "version": "0.1.21",
4
4
  "description": "Shared UI components",
5
5
  "author": "team@redocly.com",
6
6
  "license": "SEE LICENSE IN LICENSE",
package/settings.yaml ADDED
@@ -0,0 +1,9 @@
1
+ search:
2
+ hide: false
3
+ placement: navbar
4
+ toc:
5
+ header:
6
+ hide: false
7
+ label: On this page
8
+ navigation:
9
+ hide: false
@@ -1,5 +1,8 @@
1
+ import React from 'react';
1
2
  import styled, { css, FlattenSimpleInterpolation, keyframes, Keyframes } from 'styled-components';
2
3
 
4
+ import { Link } from '@portal/Link';
5
+
3
6
  export type ButtonSize = 'small' | 'medium' | 'large' | 'xlarge' | string;
4
7
  export type ButtonColor = 'primary' | 'secondary' | 'default' | string;
5
8
  export type ButtonVariant = 'outlined' | 'contained';
@@ -12,6 +15,8 @@ export interface ButtonProps {
12
15
  variant?: ButtonVariant;
13
16
  size?: ButtonSize;
14
17
  extraClass?: string;
18
+ to?: string;
19
+ onClick?: () => void;
15
20
  }
16
21
 
17
22
  const getBlink = (): Keyframes => keyframes`
@@ -59,8 +64,9 @@ export const baseButtonStyles = css`
59
64
  }
60
65
  `;
61
66
 
62
- export const Button = styled.button.attrs(({ color = 'default', extraClass }: ButtonProps) => ({
67
+ const StyledButton = styled.button.attrs(({ color = 'default', extraClass }: ButtonProps) => ({
63
68
  className: `button-color-${color}${extraClass ? ` ${extraClass}` : ''}`,
69
+ 'data-component-name': 'Button/Button',
64
70
  }))<ButtonProps>`
65
71
  text-decoration: none;
66
72
  text-align: center;
@@ -120,3 +126,15 @@ export const Button = styled.button.attrs(({ color = 'default', extraClass }: Bu
120
126
  }
121
127
  `}
122
128
  `;
129
+
130
+ export const Button: React.FC<ButtonProps> = (props) => {
131
+ if (props.to) {
132
+ return (
133
+ <Link to={props.to}>
134
+ <StyledButton {...props} />
135
+ </Link>
136
+ );
137
+ } else {
138
+ return <StyledButton {...props} />;
139
+ }
140
+ };
@@ -6,7 +6,6 @@ import { SampleControls, SamplesControlButton } from '@theme/SamplesPanelControl
6
6
  import { jsonToHTML } from '@theme/utils';
7
7
  import { useMount, useUnmount } from '@theme/hooks';
8
8
  import { CodeBlock } from '@theme/CodeBlock';
9
- import { jsonStyles } from '@theme/JsonViewer/styled';
10
9
 
11
10
  export interface JsonProps {
12
11
  data: any;
@@ -105,7 +104,112 @@ function JsonComponent({ data, jsonSampleExpandLevel, className }: JsonProps): J
105
104
  export const Json = memo<JsonProps>(JsonComponent);
106
105
 
107
106
  export const JsonViewer = styled(Json)<JsonProps>`
108
- ${jsonStyles};
107
+ .redoc-json code {
108
+ background-color: var(--samples-panel-controls-background-color);
109
+ color: var(--color-content-inverse);
110
+ padding: inherit;
111
+ border: none;
112
+
113
+ & > .collapser {
114
+ display: none;
115
+ pointer-events: none;
116
+ }
117
+ }
118
+
119
+ contain: content;
120
+ overflow-x: auto;
121
+ padding: 10px;
122
+ border-radius: var(--global-border-radius);
123
+ background-color: var(--samples-panel-controls-background-color);
124
+ color: var(--color-content-inverse);
125
+ font-size: var(--code-font-size);
126
+ font-family: var(--code-font-family);
127
+ white-space: var(--code-wrap, pre);
128
+
129
+ .callback-function {
130
+ color: gray;
131
+ }
132
+
133
+ .collapser:after {
134
+ content: '-';
135
+ cursor: pointer;
136
+ }
137
+
138
+ .collapsed > .collapser:after {
139
+ content: '+';
140
+ cursor: pointer;
141
+ }
142
+
143
+ .ellipsis:after {
144
+ content: ' … ';
145
+ }
146
+
147
+ .collapsible {
148
+ margin-left: 2ch;
149
+ }
150
+
151
+ .hoverable {
152
+ padding: 1px 2px;
153
+ }
154
+
155
+ .hovered {
156
+ background-color: rgba(235, 238, 249, 1);
157
+ }
158
+
159
+ .collapser {
160
+ background-color: transparent;
161
+ border: 0;
162
+ color: #fff;
163
+ display: flex;
164
+ align-items: center;
165
+ justify-content: center;
166
+ width: 15px;
167
+ height: 15px;
168
+ position: absolute;
169
+ top: 4px;
170
+ left: -1.5em;
171
+ cursor: default;
172
+ user-select: none;
173
+ -webkit-user-select: none;
174
+ padding: 2px;
175
+ font-family: var(--code-font-family);
176
+ font-size: var(--code-font-size);
177
+ &:focus {
178
+ outline: #fff dotted 1px;
179
+ }
180
+ }
181
+
182
+ ul {
183
+ list-style-type: none;
184
+ padding: 0;
185
+ margin: 0 0 0 26px;
186
+ }
187
+
188
+ li {
189
+ position: relative;
190
+ display: block;
191
+ }
192
+
193
+ .hoverable {
194
+ display: inline-block;
195
+ }
196
+
197
+ .selected {
198
+ outline-width: 1px;
199
+ outline-style: dotted;
200
+ }
201
+
202
+ .collapsed > .collapsible {
203
+ display: none;
204
+ }
205
+
206
+ .ellipsis {
207
+ display: none;
208
+ }
209
+
210
+ .collapsed > .ellipsis {
211
+ display: inherit;
212
+ }
109
213
  `;
110
214
 
111
215
  export const JsonViewerWrap = styled.div`
@@ -1,2 +1 @@
1
1
  export * from '@theme/JsonViewer/JsonViewer';
2
- export * from '@theme/JsonViewer/styled';
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import styled from 'styled-components';
3
3
 
4
- import { AlertIcon } from '@theme/ui/AlertIcon';
4
+ import { AlertIcon } from '@theme/icons/AlertIcon/AlertIcon';
5
5
 
6
6
  interface AdmonitionTypeProps {
7
7
  type: 'warning' | 'success' | 'danger' | 'attention' | 'info';
@@ -1,12 +1,7 @@
1
1
  import React, { useState } from 'react';
2
+ import styled, { css } from 'styled-components';
2
3
 
3
4
  import { ClipboardService } from '@theme/utils/ClipboardService';
4
- import {
5
- Wrapper,
6
- DoneIndicator,
7
- CopyCodeButton,
8
- CodeSampleButtonContainer,
9
- } from '@theme/Markdown/CodeSample/styled';
10
5
 
11
6
  type CodeSampleProps = {
12
7
  language: string;
@@ -37,3 +32,162 @@ export function CodeSample({ rawContent, highlighted, language }: CodeSampleProp
37
32
  </Wrapper>
38
33
  );
39
34
  }
35
+
36
+ const CodeSampleButtonContainer = styled.div`
37
+ position: absolute;
38
+ top: 12px;
39
+ right: 5px;
40
+ `;
41
+
42
+ const CopyCodeButton = styled.div`
43
+ padding: 0 5px;
44
+ border-radius: 4px;
45
+ display: none;
46
+ &:hover {
47
+ cursor: pointer;
48
+ }
49
+ `;
50
+
51
+ const DoneIndicator = styled.div`
52
+ padding: 0 5px;
53
+ border-radius: 4px;
54
+ cursor: default;
55
+ `;
56
+
57
+ const darkStyleTokens = css`
58
+ .token.comment,
59
+ .token.prolog,
60
+ .token.doctype,
61
+ .token.cdata {
62
+ color: hsl(30, 20%, 50%);
63
+ }
64
+ .token.property,
65
+ .token.tag,
66
+ .token.number,
67
+ .token.constant,
68
+ .token.symbol {
69
+ color: #62bff9;
70
+ }
71
+ .token.boolean {
72
+ color: firebrick;
73
+ }
74
+ .token.selector,
75
+ .token.attr-name,
76
+ .token.string,
77
+ .token.char,
78
+ .token.builtin,
79
+ .token.inserted {
80
+ color: #a0fbaa;
81
+ & + a,
82
+ & + a:visited {
83
+ color: #4ed2ba;
84
+ text-decoration: underline;
85
+ }
86
+ }
87
+ .token.operator,
88
+ .token.entity,
89
+ .token.url,
90
+ .token.variable {
91
+ color: hsl(40, 90%, 60%);
92
+ }
93
+ .token.atrule,
94
+ .token.attr-value,
95
+ .token.keyword {
96
+ color: hsl(350, 40%, 70%);
97
+ }
98
+ .token.regex,
99
+ .token.important {
100
+ color: #e90;
101
+ }
102
+ .token.deleted {
103
+ color: red;
104
+ }
105
+ `;
106
+
107
+ const Wrapper = styled.div`
108
+ overflow: auto;
109
+ border-radius: 4px;
110
+ position: relative;
111
+
112
+ ${CopyCodeButton},
113
+ ${DoneIndicator} {
114
+ color: rgba(255, 255, 255, 0.15);
115
+ }
116
+ ${CopyCodeButton}:hover {
117
+ color: #fff;
118
+ background-color: rgba(255, 255, 255, 0.15);
119
+ }
120
+
121
+ &:hover {
122
+ ${CodeSampleButtonContainer} ${CopyCodeButton} {
123
+ display: block;
124
+ }
125
+ }
126
+ pre {
127
+ white-space: var(--code-wrap);
128
+ color: white;
129
+ padding: 12px 14px 15px 14px;
130
+ overflow-x: auto;
131
+ line-height: normal;
132
+ border-radius: 4px;
133
+ font-family: var(--code-font-family);
134
+ background-color: var(--code-block-preformatted-background-color);
135
+ code {
136
+ background-color: transparent;
137
+ border: 0;
138
+ padding: 0;
139
+ color: white;
140
+ &:before,
141
+ &:after {
142
+ content: none;
143
+ }
144
+ }
145
+ }
146
+ pre[class*='language-'] {
147
+ padding: 1em;
148
+ margin: 0.5em 0;
149
+ overflow: auto;
150
+ border: 0;
151
+ border-radius: var(--global-border-radius);
152
+ }
153
+ code[class='language-text'] {
154
+ line-height: 1.2em;
155
+ display: inline-flex;
156
+ white-space: pre-wrap;
157
+ overflow-wrap: anywhere;
158
+ }
159
+ code[class*='language-'],
160
+ pre[class*='language-'] {
161
+ text-align: left;
162
+ white-space: pre;
163
+ word-spacing: normal;
164
+ word-break: normal;
165
+ word-wrap: normal;
166
+ line-height: 1.5;
167
+ -moz-tab-size: 4;
168
+ -o-tab-size: 4;
169
+ tab-size: 4;
170
+ -webkit-hyphens: none;
171
+ -moz-hyphens: none;
172
+ -ms-hyphens: none;
173
+ hyphens: none;
174
+ .token.important,
175
+ .token.bold {
176
+ font-weight: bold;
177
+ }
178
+ .token.italic {
179
+ font-style: italic;
180
+ }
181
+ .token.entity {
182
+ cursor: help;
183
+ }
184
+ .token.punctuation {
185
+ opacity: 0.7;
186
+ }
187
+ .namespace {
188
+ opacity: 0.7;
189
+ }
190
+
191
+ ${darkStyleTokens};
192
+ }
193
+ `;
@@ -1,2 +1 @@
1
1
  export * from '@theme/Markdown/CodeSample/CodeSample';
2
- export * from '@theme/Markdown/CodeSample/styled';
@@ -1,6 +1,8 @@
1
1
  import React from 'react';
2
2
  import styled from 'styled-components';
3
3
 
4
+ import { useThemeSettings } from '@portal/hooks';
5
+ import { USER_THEME_ALIAS } from '@portal/constants';
4
6
  import { ResolvedConfigLinks } from '@theme/types/portal';
5
7
  import { NavbarMenu } from '@theme/Navbar';
6
8
 
@@ -11,11 +13,16 @@ interface NavbarProps {
11
13
  }
12
14
 
13
15
  export function Navbar({ menu, logo, search }: NavbarProps): JSX.Element {
16
+ const searchThemeSettings = useThemeSettings(USER_THEME_ALIAS)?.search;
17
+ const hideSearch =
18
+ searchThemeSettings?.hide ||
19
+ (searchThemeSettings?.placement && searchThemeSettings?.placement !== 'navbar');
20
+
14
21
  return (
15
22
  <NavbarContainer data-component-name="Navbar/Navbar">
16
23
  {logo}
17
24
  <NavbarMenu menuItems={menu} />
18
- {search}
25
+ {hideSearch ? null : search}
19
26
  </NavbarContainer>
20
27
  );
21
28
  }
@@ -2,7 +2,9 @@ import React from 'react';
2
2
 
3
3
  import type { ResolvedNavLinkItem } from '@theme/types/portal';
4
4
  import { usePageData } from '@portal/hooks/usePageData';
5
- import { Button } from '@theme/ui';
5
+ import { useThemeSettings } from '@portal/hooks/';
6
+ import { DEFAULT_THEME_NAME } from '@portal/constants/';
7
+ import { Button } from '@theme/Button/Button';
6
8
 
7
9
  interface NextPageType {
8
10
  nextPage?: ResolvedNavLinkItem | null;
@@ -10,13 +12,17 @@ interface NextPageType {
10
12
 
11
13
  export function NextPageLink(): JSX.Element {
12
14
  const { nextPage }: NextPageType = usePageData() || {};
13
- if (!nextPage) {
15
+ const { themeSettings } = useThemeSettings(DEFAULT_THEME_NAME);
16
+
17
+ if (!nextPage || themeSettings?.navigation?.hide) {
14
18
  return <div>&nbsp;</div>;
15
19
  }
16
20
 
21
+ const label = themeSettings?.navigation?.nextPageLink?.label || `Next to ${nextPage.label}`;
22
+
17
23
  return (
18
24
  <Button variant="outlined" size="large" to={nextPage.link}>
19
- Next to {nextPage.label}
25
+ {label}
20
26
  </Button>
21
27
  );
22
28
  }
@@ -2,7 +2,9 @@ import React from 'react';
2
2
 
3
3
  import type { ResolvedNavLinkItem } from '@theme/types/portal';
4
4
  import { usePageData } from '@portal/hooks/usePageData';
5
- import { Button } from '@theme/ui';
5
+ import { useThemeSettings } from '@portal/hooks';
6
+ import { DEFAULT_THEME_NAME } from '@portal/constants';
7
+ import { Button } from '@theme/Button/Button';
6
8
 
7
9
  interface PreviousPageType {
8
10
  prevPage?: ResolvedNavLinkItem | null;
@@ -10,13 +12,17 @@ interface PreviousPageType {
10
12
 
11
13
  export function PreviousPageLink(): JSX.Element {
12
14
  const { prevPage }: PreviousPageType = usePageData() || {};
13
- if (!prevPage) {
15
+ const { themeSettings } = useThemeSettings(DEFAULT_THEME_NAME);
16
+
17
+ if (!prevPage || themeSettings?.navigation?.hide) {
14
18
  return <div>&nbsp;</div>;
15
19
  }
16
20
 
21
+ const label = themeSettings?.navigation?.nextPageLink?.label || `Back to ${prevPage.label}`;
22
+
17
23
  return (
18
24
  <Button variant="outlined" size="large" to={prevPage.link}>
19
- Back to {prevPage.label}
25
+ {label}
20
26
  </Button>
21
27
  );
22
28
  }
@@ -0,0 +1,13 @@
1
+ import styled from 'styled-components';
2
+
3
+ import { Search } from '@theme/Search/Search';
4
+ import { Popover } from '@theme/Search/Popover';
5
+
6
+ export const SidebarSearch = styled(Search)`
7
+ --search-input-text-color: var(--sidebar-item-active-color);
8
+
9
+ ${Popover} {
10
+ right: unset;
11
+ top: 100%;
12
+ }
13
+ `;
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import styled from 'styled-components';
3
3
 
4
- import { Arrow } from '@theme/ui/Arrow';
4
+ import { ArrowIcon } from '@theme/icons/ArrowIcon/ArrowIcon';
5
5
  import { ItemState } from '@theme/Sidebar/types/ItemState';
6
6
  import { MenuLinkItem } from '@theme/Sidebar/MenuLinkItem';
7
7
  import { MenuItemLabel } from '@theme/Sidebar/MenuItemLabel';
@@ -50,6 +50,6 @@ const MenuGroupLabel = styled(MenuItemLabel)<{ isAlwaysExpanded?: boolean }>`
50
50
  cursor: ${(props) => (props.isAlwaysExpanded ? 'default' : 'pointer')};
51
51
  `;
52
52
 
53
- const MenuGroupArrow = styled(Arrow)`
53
+ const MenuGroupArrow = styled(ArrowIcon)`
54
54
  margin-right: calc(var(--sidebar-spacing-unit) / 2);
55
55
  `;
@@ -5,6 +5,9 @@ import { Sidebar } from '@theme/Sidebar/Sidebar';
5
5
  import { useMobileMenu } from '@theme/hooks/useMobileMenu';
6
6
  import { MobileSidebarButton } from '@theme/Sidebar/MobileSidebarButton';
7
7
  import { MenuContainer } from '@theme/Sidebar/MenuContainer';
8
+ import { useThemeSettings } from '@portal/hooks/';
9
+ import { DEFAULT_THEME_NAME } from '@portal/constants/';
10
+ import { SidebarSearch } from '@theme/Search/SidebarSearch';
8
11
 
9
12
  interface SidebarLayoutProps {
10
13
  versions: React.ReactNode;
@@ -14,11 +17,13 @@ interface SidebarLayoutProps {
14
17
  export function SidebarLayout({ versions, menu }: SidebarLayoutProps): JSX.Element {
15
18
  const [isOpen, setIsOpen] = useMobileMenu();
16
19
  const toggleMenu = () => setIsOpen(!isOpen);
20
+ const { hide, placement } = useThemeSettings(DEFAULT_THEME_NAME).search || {};
17
21
 
18
22
  return (
19
23
  <Wrapper data-component-name="Sidebar/SidebarLayout">
20
24
  <MobileSidebarButton opened={isOpen} onClick={toggleMenu} />
21
25
 
26
+ {!hide && placement === 'sidebar' ? <SidebarSearch /> : null}
22
27
  <Sidebar animate={true} opened={isOpen}>
23
28
  {versions}
24
29
  <MenuContainer>{menu}</MenuContainer>
@@ -2,8 +2,10 @@ import React, { useRef } from 'react';
2
2
  import styled from 'styled-components';
3
3
 
4
4
  import { useFullHeight } from '@theme/hooks/useFullHeight';
5
+ import { useThemeSettings } from '@portal/hooks';
5
6
  import { useActiveHeading } from '@theme/hooks/useActiveHeading';
6
7
  import { MdHeading } from '@theme/types/portal';
8
+ import { DEFAULT_THEME_NAME } from '@portal/constants';
7
9
 
8
10
  interface TableOfContentProps {
9
11
  headings?: Array<MdHeading | null> | null | undefined;
@@ -17,7 +19,11 @@ export function TableOfContent(props: TableOfContentProps): JSX.Element | null {
17
19
  const sidebar = useRef<HTMLDivElement | null>(null);
18
20
  useFullHeight(sidebar);
19
21
  const activeHeadingId = useActiveHeading(contentWrapper);
22
+ const { themeSettings } = useThemeSettings(DEFAULT_THEME_NAME);
20
23
 
24
+ if (themeSettings?.toc?.hide) {
25
+ return null;
26
+ }
21
27
  if (headings && headings.length === 1 && (!headings[0] || headings[0].depth === 1)) {
22
28
  return null;
23
29
  }
@@ -30,7 +36,7 @@ export function TableOfContent(props: TableOfContentProps): JSX.Element | null {
30
36
  {headings && (
31
37
  <TableOfContentMenu data-component-name="TableOfContent/TableOfContent">
32
38
  <TableOfContentItems ref={sidebar}>
33
- <TocHeader>On this page</TocHeader>
39
+ <TocHeader>{themeSettings?.toc?.header?.label || 'On this page'}</TocHeader>
34
40
  {headings.map((heading: MdHeading | null, idx: number) => {
35
41
  // TODO: not sure about !heading
36
42
  if (!heading) {
@@ -0,0 +1,9 @@
1
+ import styled from 'styled-components';
2
+
3
+ import { Typography } from '@theme/Typography/Typography';
4
+
5
+ export const CompactTypography = styled(Typography).attrs(() => ({
6
+ mt: '0em',
7
+ mb: '0em',
8
+ 'data-component-name': 'Typography/CompactTypography',
9
+ }))``;