@redocly/theme 0.1.20 → 0.1.23

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 (107) hide show
  1. package/Button/Button.d.ts +4 -3
  2. package/Button/Button.js +29 -2
  3. package/Footer/Footer.js +4 -1
  4. package/JsonViewer/JsonViewer.js +1 -2
  5. package/JsonViewer/index.d.ts +0 -1
  6. package/JsonViewer/index.js +0 -1
  7. package/Markdown/Admonition.js +1 -1
  8. package/Markdown/CodeSample/CodeSample.js +15 -5
  9. package/Markdown/CodeSample/index.d.ts +0 -1
  10. package/Markdown/CodeSample/index.js +0 -1
  11. package/Navbar/Navbar.d.ts +1 -1
  12. package/Navbar/Navbar.js +10 -1
  13. package/PageNavigation/NextPageLink.js +8 -5
  14. package/PageNavigation/PreviousPageLink.js +8 -5
  15. package/Search/SidebarSearch.d.ts +2 -0
  16. package/Search/SidebarSearch.js +15 -0
  17. package/Sidebar/MenuGroup.js +2 -2
  18. package/Sidebar/SidebarLayout.d.ts +1 -1
  19. package/Sidebar/SidebarLayout.js +8 -0
  20. package/TableOfContent/TableOfContent.js +8 -1
  21. package/Typography/CompactTypography.d.ts +11 -0
  22. package/Typography/CompactTypography.js +18 -0
  23. package/Typography/Emphasis.d.ts +3 -0
  24. package/Typography/Emphasis.js +15 -0
  25. package/Typography/H1.d.ts +3 -0
  26. package/Typography/H1.js +16 -0
  27. package/Typography/H2.d.ts +3 -0
  28. package/Typography/H2.js +16 -0
  29. package/Typography/H3.d.ts +3 -0
  30. package/Typography/H3.js +16 -0
  31. package/Typography/SectionHeader.d.ts +1 -0
  32. package/Typography/SectionHeader.js +13 -0
  33. package/Typography/Typography.d.ts +8 -0
  34. package/Typography/Typography.js +22 -0
  35. package/Typography/index.d.ts +7 -0
  36. package/{Headings → Typography}/index.js +7 -1
  37. package/{ui → icons/AlertIcon}/AlertIcon.d.ts +2 -2
  38. package/{ui → icons/AlertIcon}/AlertIcon.js +1 -1
  39. package/icons/AlertIcon/index.d.ts +2 -0
  40. package/icons/AlertIcon/index.js +5 -0
  41. package/icons/ArrowIcon/ArrowIcon.d.ts +7 -0
  42. package/{ui/Arrow.js → icons/ArrowIcon/ArrowIcon.js} +3 -3
  43. package/icons/ArrowIcon/index.d.ts +2 -0
  44. package/icons/ArrowIcon/index.js +5 -0
  45. package/icons/index.d.ts +2 -0
  46. package/icons/index.js +2 -0
  47. package/index.d.ts +1 -1
  48. package/index.js +1 -1
  49. package/mocks/constants/index.d.ts +2 -0
  50. package/mocks/constants/index.js +5 -0
  51. package/mocks/hooks/index.d.ts +6 -0
  52. package/mocks/hooks/index.js +16 -0
  53. package/package.json +1 -1
  54. package/settings.yaml +15 -0
  55. package/src/Button/Button.tsx +21 -1
  56. package/src/Footer/Footer.tsx +5 -1
  57. package/src/JsonViewer/JsonViewer.tsx +106 -2
  58. package/src/JsonViewer/index.ts +0 -1
  59. package/src/Markdown/Admonition.tsx +1 -1
  60. package/src/Markdown/CodeSample/CodeSample.tsx +160 -6
  61. package/src/Markdown/CodeSample/index.ts +0 -1
  62. package/src/Navbar/Navbar.tsx +13 -2
  63. package/src/PageNavigation/NextPageLink.tsx +9 -3
  64. package/src/PageNavigation/PreviousPageLink.tsx +9 -3
  65. package/src/Search/SidebarSearch.tsx +13 -0
  66. package/src/Sidebar/MenuGroup.tsx +2 -2
  67. package/src/Sidebar/SidebarLayout.tsx +10 -1
  68. package/src/TableOfContent/TableOfContent.tsx +7 -1
  69. package/src/Typography/CompactTypography.ts +9 -0
  70. package/src/Typography/Emphasis.ts +7 -0
  71. package/src/Typography/H1.ts +12 -0
  72. package/src/Typography/H2.ts +12 -0
  73. package/src/Typography/H3.ts +11 -0
  74. package/src/Typography/SectionHeader.ts +11 -0
  75. package/src/Typography/Typography.ts +21 -0
  76. package/src/Typography/index.ts +7 -0
  77. package/src/{ui → icons/AlertIcon}/AlertIcon.tsx +3 -3
  78. package/src/icons/AlertIcon/index.ts +2 -0
  79. package/src/{ui/Arrow.tsx → icons/ArrowIcon/ArrowIcon.tsx} +5 -5
  80. package/src/icons/ArrowIcon/index.ts +2 -0
  81. package/src/icons/index.ts +2 -0
  82. package/src/index.ts +1 -1
  83. package/src/mocks/constants/index.ts +2 -0
  84. package/src/mocks/hooks/index.ts +17 -0
  85. package/src/ui/Jumbotron.tsx +1 -1
  86. package/src/ui/index.tsx +0 -4
  87. package/ui/Jumbotron.js +1 -1
  88. package/ui/index.d.ts +0 -4
  89. package/ui/index.js +0 -4
  90. package/Headings/Headings.d.ts +0 -3
  91. package/Headings/Headings.js +0 -16
  92. package/Headings/index.d.ts +0 -1
  93. package/JsonViewer/styled.d.ts +0 -1
  94. package/JsonViewer/styled.js +0 -10
  95. package/Markdown/CodeSample/styled.d.ts +0 -4
  96. package/Markdown/CodeSample/styled.js +0 -85
  97. package/src/Headings/Headings.ts +0 -23
  98. package/src/Headings/index.ts +0 -1
  99. package/src/JsonViewer/styled.ts +0 -110
  100. package/src/Markdown/CodeSample/styled.ts +0 -209
  101. package/src/ui/Button.tsx +0 -19
  102. package/src/ui/Typography.tsx +0 -90
  103. package/ui/Arrow.d.ts +0 -7
  104. package/ui/Button.d.ts +0 -7
  105. package/ui/Button.js +0 -30
  106. package/ui/Typography.d.ts +0 -41
  107. package/ui/Typography.js +0 -59
@@ -40,7 +40,7 @@ function Icon(_a) {
40
40
  }
41
41
  }
42
42
  exports.AlertIcon = (0, styled_components_1.default)(Icon).attrs(function () { return ({
43
- 'data-component-name': 'ui/AlertIcon',
43
+ 'data-component-name': 'icons/AlertIcon/AlertIcon',
44
44
  }); })(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: absolute;\n left: var(--admonition-padding-horizontal);\n top: 50%;\n transform: translateY(-50%);\n width: var(--admonition-icon-size);\n height: var(--admonition-icon-size);\n margin-right: var(--admonition-padding-horizontal);\n flex-shrink: 0;\n\n fill: ", ";\n"], ["\n position: absolute;\n left: var(--admonition-padding-horizontal);\n top: 50%;\n transform: translateY(-50%);\n width: var(--admonition-icon-size);\n height: var(--admonition-icon-size);\n margin-right: var(--admonition-padding-horizontal);\n flex-shrink: 0;\n\n fill: ", ";\n"])), function (_a) {
45
45
  var type = _a.type;
46
46
  return "var(--admonition-".concat(type, "-icon-color)");
@@ -0,0 +1,2 @@
1
+ export { AlertIcon } from '../../icons/AlertIcon/AlertIcon';
2
+ export type { AlertIconProps } from '../../icons/AlertIcon/AlertIcon';
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AlertIcon = void 0;
4
+ var AlertIcon_1 = require("../../icons/AlertIcon/AlertIcon");
5
+ Object.defineProperty(exports, "AlertIcon", { enumerable: true, get: function () { return AlertIcon_1.AlertIcon; } });
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ export interface ArrowIconProps {
3
+ direction?: 'up' | 'right' | 'left' | 'down';
4
+ }
5
+ export declare const ArrowIcon: import("styled-components").StyledComponent<({ className }: {
6
+ className?: string | undefined;
7
+ }) => JSX.Element, any, ArrowIconProps, never>;
@@ -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.23",
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,15 @@
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
10
+ navbar:
11
+ hide: false
12
+ sidebar:
13
+ hide: false
14
+ footer:
15
+ 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?: (e?: any) => 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,17 @@ export const Button = styled.button.attrs(({ color = 'default', extraClass }: Bu
120
126
  }
121
127
  `}
122
128
  `;
129
+
130
+ const ButtonComponent: 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
+ };
141
+
142
+ export const Button = styled(ButtonComponent)``;
@@ -4,13 +4,17 @@ import styled from 'styled-components';
4
4
  import { FooterColumns } from '@theme/Footer/FooterColumns';
5
5
  import { FooterCopyright } from '@theme/Footer/FooterCopyright';
6
6
  import type { NavGroupRecord } from '@theme/types/portal';
7
+ import { useThemeSettings } from '@portal/hooks';
8
+ import { USER_THEME_ALIAS } from '@portal/constants';
7
9
 
8
10
  interface FooterProps {
9
11
  data: NavGroupRecord;
10
12
  }
11
13
 
12
14
  export function Footer({ data: { columns, copyrightText } }: FooterProps): JSX.Element | null {
13
- if (!(columns?.length || copyrightText)) {
15
+ const { footer } = useThemeSettings(USER_THEME_ALIAS);
16
+
17
+ if (!(columns?.length || copyrightText) || footer?.hide) {
14
18
  return null;
15
19
  }
16
20
 
@@ -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
 
@@ -10,12 +12,21 @@ interface NavbarProps {
10
12
  search: React.ReactNode;
11
13
  }
12
14
 
13
- export function Navbar({ menu, logo, search }: NavbarProps): JSX.Element {
15
+ export function Navbar({ menu, logo, search }: NavbarProps): JSX.Element | null {
16
+ const settings = useThemeSettings(USER_THEME_ALIAS);
17
+ const searchSettings = settings.search;
18
+ const hideSearch =
19
+ searchSettings?.hide || (searchSettings?.placement && searchSettings?.placement !== 'navbar');
20
+
21
+ if (settings?.navbar?.hide) {
22
+ return null;
23
+ }
24
+
14
25
  return (
15
26
  <NavbarContainer data-component-name="Navbar/Navbar">
16
27
  {logo}
17
28
  <NavbarMenu menuItems={menu} />
18
- {search}
29
+ {hideSearch ? null : search}
19
30
  </NavbarContainer>
20
31
  );
21
32
  }
@@ -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
  `;