@redocly/theme 0.1.11 → 0.1.14

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 (135) hide show
  1. package/CodeBlock/CodeBlock.js +2 -1
  2. package/Markdown/CodeSample/index.d.ts +0 -1
  3. package/Markdown/CodeSample/index.js +0 -1
  4. package/Markdown/CodeSample/styled.d.ts +0 -1
  5. package/Markdown/CodeSample/styled.js +10 -102
  6. package/Markdown/StyledMarkdown.d.ts +0 -2
  7. package/Markdown/StyledMarkdown.js +5 -16
  8. package/OperationBadge/OperationBadge.js +1 -1
  9. package/PageNavigation/NextPageLink.js +1 -1
  10. package/PageNavigation/PreviousPageLink.js +1 -1
  11. package/Search/ClearIcon.js +1 -1
  12. package/Search/Input.js +1 -1
  13. package/Search/Popover.js +1 -1
  14. package/Search/SearchIcon.js +1 -1
  15. package/Search/SearchItem.js +1 -1
  16. package/Sidebar/ApiCallItem.js +1 -1
  17. package/globalStyle.js +24 -6
  18. package/mocks/Link.js +1 -1
  19. package/mocks/hooks/usePageData.d.ts +1 -1
  20. package/package.json +1 -1
  21. package/src/CodeBlock/CodeBlock.ts +3 -42
  22. package/src/Markdown/CodeSample/index.ts +0 -1
  23. package/src/Markdown/CodeSample/styled.ts +65 -195
  24. package/src/Markdown/StyledMarkdown.tsx +14 -28
  25. package/src/OperationBadge/OperationBadge.ts +5 -2
  26. package/src/PageNavigation/NextPageLink.tsx +2 -2
  27. package/src/PageNavigation/PreviousPageLink.tsx +2 -2
  28. package/src/Search/ClearIcon.tsx +1 -1
  29. package/src/Search/Input.tsx +7 -7
  30. package/src/Search/Popover.tsx +2 -2
  31. package/src/Search/SearchIcon.tsx +1 -1
  32. package/src/Search/SearchItem.tsx +1 -1
  33. package/src/Sidebar/ApiCallItem.tsx +1 -2
  34. package/src/globalStyle.ts +660 -461
  35. package/src/mocks/Link.tsx +1 -1
  36. package/src/mocks/hooks/usePageData.ts +1 -1
  37. package/src/ui/Typography.tsx +12 -89
  38. package/src/ui/UniversalLink.tsx +3 -8
  39. package/src/utils/ClipboardService.ts +3 -86
  40. package/src/utils/isUrl.ts +4 -4
  41. package/src/utils/theme-helpers.ts +46 -0
  42. package/ui/Typography.d.ts +2 -71
  43. package/ui/Typography.js +15 -93
  44. package/ui/UniversalLink.js +1 -5
  45. package/utils/ClipboardService.d.ts +1 -5
  46. package/utils/ClipboardService.js +2 -73
  47. package/utils/isUrl.d.ts +2 -2
  48. package/utils/isUrl.js +4 -4
  49. package/utils/theme-helpers.d.ts +1 -0
  50. package/utils/theme-helpers.js +42 -2
  51. package/Markdown/CodeSample/types.d.ts +0 -9
  52. package/Markdown/CodeSample/types.js +0 -2
  53. package/src/Button/Button.stories.tsx +0 -74
  54. package/src/Button/__tests__/Button.test.tsx +0 -42
  55. package/src/Button/__tests__/__snapshots__/Button.test.tsx.snap +0 -274
  56. package/src/CodeBlock/__tests__/CodeBlock.test.tsx +0 -12
  57. package/src/CodeBlock/__tests__/__snapshots__/CodeBlock.test.tsx.snap +0 -140
  58. package/src/CopyButton/CopyButton.stories.tsx +0 -18
  59. package/src/CopyButton/__tests__/CopyButton.test.tsx +0 -35
  60. package/src/CopyButton/__tests__/CopyButtonWrapper.test.tsx +0 -17
  61. package/src/CopyButton/__tests__/__snapshots__/CopyButton.test.tsx.snap +0 -55
  62. package/src/CopyButton/__tests__/__snapshots__/CopyButtonWrapper.test.tsx.snap +0 -46
  63. package/src/DesignTokens/borders.stories.mdx +0 -20
  64. package/src/DesignTokens/colors.stories.mdx +0 -24
  65. package/src/DesignTokens/page-layout.stories.mdx +0 -12
  66. package/src/DesignTokens/tokens-generated.scss +0 -610
  67. package/src/DesignTokens/typography.stories.mdx +0 -36
  68. package/src/Footer/Footer.stories.tsx +0 -57
  69. package/src/Footer/__tests__/Footer.test.tsx +0 -55
  70. package/src/Footer/__tests__/__snapshots__/Footer.test.tsx.snap +0 -253
  71. package/src/Headings/Headings.stories.tsx +0 -36
  72. package/src/Headings/__tests__/Headings.test.tsx +0 -24
  73. package/src/Headings/__tests__/__snapshots__/Headings.test.tsx.snap +0 -57
  74. package/src/JsonViewer/JsonViewer.stories.tsx +0 -57
  75. package/src/JsonViewer/__tests__/JsonViewer.test.tsx +0 -83
  76. package/src/JsonViewer/__tests__/__snapshots__/JsonViewer.test.tsx.snap +0 -2728
  77. package/src/Layout/__tests__/PageLayout.test.tsx +0 -17
  78. package/src/Layout/__tests__/RootLayout.test.tsx +0 -17
  79. package/src/Layout/__tests__/__snapshots__/PageLayout.test.tsx.snap +0 -38
  80. package/src/Layout/__tests__/__snapshots__/RootLayout.test.tsx.snap +0 -18
  81. package/src/Markdown/CodeSample/types.ts +0 -40
  82. package/src/Navbar/Navbar.stories.tsx +0 -32
  83. package/src/Navbar/__tests__/Navbar.test.tsx +0 -55
  84. package/src/Navbar/__tests__/__snapshots__/Navbar.test.tsx.snap +0 -256
  85. package/src/NavbarLogo/NavbarLogo.stories.tsx +0 -20
  86. package/src/NavbarLogo/__tests__/NavbarLogo.test.tsx +0 -47
  87. package/src/NavbarLogo/__tests__/__snapshots__/NavbarLogo.test.tsx.snap +0 -38
  88. package/src/OperationBadge/OperationBadge.stories.tsx +0 -35
  89. package/src/OperationBadge/__tests__/OperationBadge.test.tsx +0 -59
  90. package/src/OperationBadge/__tests__/__snapshots__/OperationBadge.test.tsx.snap +0 -651
  91. package/src/PageNavigation/PageNavigation.stories.tsx +0 -21
  92. package/src/PageNavigation/__tests__/NextPageLink.test.tsx +0 -29
  93. package/src/PageNavigation/__tests__/PageNavigation.test.tsx +0 -54
  94. package/src/PageNavigation/__tests__/PreviousPageLink.test.tsx +0 -29
  95. package/src/PageNavigation/__tests__/__snapshots__/NextPageLink.test.tsx.snap +0 -67
  96. package/src/PageNavigation/__tests__/__snapshots__/PageNavigation.test.tsx.snap +0 -275
  97. package/src/PageNavigation/__tests__/__snapshots__/PreviousPageLink.test.tsx.snap +0 -67
  98. package/src/Panel/CodePanel.stories.tsx +0 -26
  99. package/src/Panel/ContentPanel.stories.tsx +0 -26
  100. package/src/Panel/Panel.stories.tsx +0 -56
  101. package/src/Panel/__tests__/CodePanel.test.tsx +0 -26
  102. package/src/Panel/__tests__/ContentPanel.test.tsx +0 -26
  103. package/src/Panel/__tests__/Panel.test.tsx +0 -53
  104. package/src/Panel/__tests__/__snapshots__/CodePanel.test.tsx.snap +0 -258
  105. package/src/Panel/__tests__/__snapshots__/ContentPanel.test.tsx.snap +0 -278
  106. package/src/Panel/__tests__/__snapshots__/Panel.test.tsx.snap +0 -398
  107. package/src/SamplesPanelControls/SamplesControlButton.stories.tsx +0 -18
  108. package/src/SamplesPanelControls/__tests__/SamplesPanelControls.test.tsx +0 -36
  109. package/src/SamplesPanelControls/__tests__/__snapshots__/SamplesPanelControls.test.tsx.snap +0 -228
  110. package/src/Search/__tests__/Input.test.tsx +0 -13
  111. package/src/Search/__tests__/__snapshots__/Input.test.tsx.snap +0 -36
  112. package/src/SidebarLogo/SidebarLogo.stories.tsx +0 -21
  113. package/src/SidebarLogo/__tests__/SidebarLogo.test.tsx +0 -32
  114. package/src/SidebarLogo/__tests__/__snapshots__/SidebarLogo.test.tsx.snap +0 -62
  115. package/src/SourceCode/SourceCode.stories.tsx +0 -29
  116. package/src/SourceCode/__tests__/SourceCode.test.tsx +0 -48
  117. package/src/SourceCode/__tests__/__snapshots__/SourceCode.test.tsx.snap +0 -786
  118. package/src/TableOfContent/TableOfContent.stories.tsx +0 -37
  119. package/src/TableOfContent/__tests__/TableOfContent.test.tsx +0 -61
  120. package/src/TableOfContent/__tests__/__snapshots__/TableOfContent.test.tsx.snap +0 -153
  121. package/src/Tooltip/Tooltip.stories.tsx +0 -27
  122. package/src/Tooltip/__tests__/Tooltip.test.tsx +0 -41
  123. package/src/Tooltip/__tests__/__snapshots__/Tooltip.test.tsx.snap +0 -83
  124. package/src/Welcome.stories.mdx +0 -7
  125. package/src/icons/ShelfIcon/ShelfIcon.stories.tsx +0 -36
  126. package/src/icons/ShelfIcon/__tests__/ShelfIcon.test.tsx +0 -54
  127. package/src/icons/ShelfIcon/__tests__/__snapshots__/ShelfIcon.test.tsx.snap +0 -235
  128. package/src/utils/__tests__/ClipboardService.test.ts +0 -24
  129. package/src/utils/__tests__/__snapshots__/highlight.test.ts.snap +0 -5
  130. package/src/utils/__tests__/__snapshots__/jsonToHtml.test.ts.snap +0 -5
  131. package/src/utils/__tests__/css-variables.test.ts +0 -20
  132. package/src/utils/__tests__/highlight.test.ts +0 -51
  133. package/src/utils/__tests__/jsonToHtml.test.ts +0 -40
  134. package/src/utils/__tests__/media-css.test.ts +0 -20
  135. package/src/utils/__tests__/theme-helpers.test.ts +0 -25
@@ -1,44 +1,6 @@
1
- import { getLuminance } from 'polished';
2
- import styled, { css } from 'styled-components';
1
+ import styled from 'styled-components';
3
2
 
4
- import { typography } from '@theme/ui/Typography';
5
- import type { Tokens, Token } from '@theme/Markdown/CodeSample/types';
6
- import { AppTheme } from '@theme/types/portal';
7
-
8
- function genTokens(tokens?: Tokens | null) {
9
- if (!tokens) {
10
- return '';
11
- }
12
-
13
- let res = '';
14
-
15
- for (const token of Object.keys(tokens)) {
16
- if (token !== 'default') {
17
- res += `.token.${token} { color: ${tokens[token as Token]?.color}; }\n`;
18
- }
19
- }
20
-
21
- if (tokens.default) {
22
- return css`
23
- pre& {
24
- ${typography(tokens.default)}
25
- }
26
- ${res}
27
- `;
28
- }
29
-
30
- return res;
31
- }
32
-
33
- const getCodeBlockBackgroundColor = (theme: AppTheme) =>
34
- Array.isArray(theme.codeBlock.backgroundColor)
35
- ? theme.codeBlock.backgroundColor[0]
36
- : theme.codeBlock.backgroundColor;
37
-
38
- export const CodeButton = css`
39
- padding: 0 5px;
40
- border-radius: 4px;
41
- `;
3
+ import { generateCodeBlockTokens } from '@theme';
42
4
 
43
5
  export const CodeSampleButtonContainer = styled.div`
44
6
  position: absolute;
@@ -47,208 +9,72 @@ export const CodeSampleButtonContainer = styled.div`
47
9
  `;
48
10
 
49
11
  export const CopyCodeButton = styled.div`
50
- ${CodeButton}
12
+ padding: 0 5px;
13
+ border-radius: 4px;
51
14
  display: none;
52
-
53
15
  &:hover {
54
16
  cursor: pointer;
55
17
  }
56
18
  `;
57
19
 
58
20
  export const DoneIndicator = styled.div`
59
- ${CodeButton}
21
+ padding: 0 5px;
22
+ border-radius: 4px;
60
23
  cursor: default;
61
24
  `;
62
25
 
63
- const lightStyleCodeButton = css`
64
- ${CopyCodeButton},
65
- ${DoneIndicator} {
66
- color: ${({ theme }) => theme.codeBlock.copyButton.visibleText};
67
- }
68
-
69
- ${CopyCodeButton}:hover {
70
- color: ${({ theme }) => theme.codeBlock.copyButton.visibleText};
71
- outline: 1px solid ${({ theme }) => theme.codeBlock.copyButton.visibleText};
72
- }
73
- `;
26
+ export const Wrapper = styled.div`
27
+ overflow: auto;
28
+ border-radius: 4px;
29
+ position: relative;
74
30
 
75
- const darkStyleCodeButton = css`
76
31
  ${CopyCodeButton},
77
32
  ${DoneIndicator} {
78
- color: ${({ theme }) => theme.codeBlock.copyButton.visibleText};
33
+ color: rgba(255, 255, 255, 0.15);
79
34
  }
80
-
81
35
  ${CopyCodeButton}:hover {
82
36
  color: white;
83
- color: ${({ theme }) => theme.codeBlock.copyButton.contrastText};
84
- background-color: ${({ theme }) => theme.codeBlock.copyButton.background};
85
- }
86
- `;
87
-
88
- const lightStyleTokens = css`
89
- .token.comment,
90
- .token.prolog,
91
- .token.doctype,
92
- .token.cdata {
93
- color: #999988;
94
- font-style: italic;
95
- }
96
-
97
- .token.namespace {
98
- opacity: 0.7;
99
- }
100
-
101
- .token.string,
102
- .token.attr-value {
103
- color: #e3116c;
104
- }
105
- .token.punctuation,
106
- .token.operator {
107
- color: #393a34; /* no highlight */
108
- }
109
-
110
- .token.entity,
111
- .token.url,
112
- .token.symbol,
113
- .token.number,
114
- .token.boolean,
115
- .token.variable,
116
- .token.constant,
117
- .token.property,
118
- .token.regex,
119
- .token.inserted {
120
- color: #36acaa;
121
- }
122
-
123
- .token.atrule,
124
- .token.keyword,
125
- .token.attr-name,
126
- .language-autohotkey .token.selector {
127
- color: #00a4db;
37
+ outline: 1px solid white;
128
38
  }
129
39
 
130
- .token.function,
131
- .token.deleted,
132
- .language-autohotkey .token.tag {
133
- color: #9a050f;
134
- }
135
-
136
- .token.tag,
137
- .token.selector,
138
- .language-autohotkey .token.keyword {
139
- color: #00009f;
140
- }
141
- `;
142
-
143
- const darkStyleTokens = css`
144
- .token.comment,
145
- .token.prolog,
146
- .token.doctype,
147
- .token.cdata {
148
- color: hsl(30, 20%, 50%);
149
- }
150
-
151
- .token.property,
152
- .token.tag,
153
- .token.number,
154
- .token.constant,
155
- .token.symbol {
156
- color: #62bff9;
157
- }
158
- .token.boolean {
159
- color: firebrick;
160
- }
161
- .token.selector,
162
- .token.attr-name,
163
- .token.string,
164
- .token.char,
165
- .token.builtin,
166
- .token.inserted {
167
- color: #a0fbaa;
168
- & + a,
169
- & + a:visited {
170
- color: #4ed2ba;
171
- text-decoration: underline;
172
- }
173
- }
174
- .token.operator,
175
- .token.entity,
176
- .token.url,
177
- .token.variable {
178
- color: hsl(40, 90%, 60%);
179
- }
180
- .token.atrule,
181
- .token.attr-value,
182
- .token.keyword {
183
- color: hsl(350, 40%, 70%);
184
- }
185
- .token.regex,
186
- .token.important {
187
- color: #e90;
188
- }
189
-
190
- .token.deleted {
191
- color: red;
192
- }
193
- `;
194
-
195
- export const Wrapper = styled.div`
196
- overflow: auto;
197
- border-radius: 4px;
198
- position: relative;
199
-
200
- ${({ theme }) =>
201
- getLuminance(getCodeBlockBackgroundColor(theme)) < 0.25
202
- ? darkStyleCodeButton
203
- : lightStyleCodeButton}
204
-
205
40
  &:hover {
206
41
  ${CodeSampleButtonContainer} ${CopyCodeButton} {
207
42
  display: block;
208
43
  }
209
44
  }
210
-
211
45
  pre {
212
- white-space: ${({ theme }) => (theme.typography.code.wrap ? 'pre-wrap' : 'pre')};
46
+ white-space: var(--code-wrap);
213
47
  color: white;
214
48
  padding: 12px 14px 15px 14px;
215
49
  overflow-x: auto;
216
50
  line-height: normal;
217
51
  border-radius: 4px;
218
-
219
- font-family: ${({ theme }) => theme.typography.code.fontFamily};
220
- background-color: ${({ theme }) => theme.codeBlock.backgroundColor};
221
-
52
+ font-family: var(--code-font-family);
53
+ background-color: var(--code-block-preformatted-background-color);
222
54
  code {
223
55
  background-color: transparent;
224
56
  border: 0;
225
57
  padding: 0;
226
-
227
- color: ${({ theme }) =>
228
- getLuminance(theme.codeBlock.backgroundColor) < 0.5 ? 'white' : '#393A34'};
229
-
58
+ color: white;
230
59
  &:before,
231
60
  &:after {
232
61
  content: none;
233
62
  }
234
63
  }
235
64
  }
236
-
237
65
  pre[class*='language-'] {
238
66
  padding: 1em;
239
67
  margin: 0.5em 0;
240
68
  overflow: auto;
241
69
  border: 0;
242
- border-radius: ${({ theme }) => theme.shape.borderRadius};
70
+ border-radius: var(--global-border-radius);
243
71
  }
244
-
245
72
  code[class='language-text'] {
246
73
  line-height: 1.2em;
247
74
  display: inline-flex;
248
75
  white-space: pre-wrap;
249
76
  overflow-wrap: anywhere;
250
77
  }
251
-
252
78
  code[class*='language-'],
253
79
  pre[class*='language-'] {
254
80
  text-align: left;
@@ -264,7 +90,6 @@ export const Wrapper = styled.div`
264
90
  -moz-hyphens: none;
265
91
  -ms-hyphens: none;
266
92
  hyphens: none;
267
-
268
93
  .token.important,
269
94
  .token.bold {
270
95
  font-weight: bold;
@@ -282,8 +107,53 @@ export const Wrapper = styled.div`
282
107
  opacity: 0.7;
283
108
  }
284
109
 
285
- ${({ theme }) =>
286
- getLuminance(getCodeBlockBackgroundColor(theme)) < 0.5 ? darkStyleTokens : lightStyleTokens}
287
- ${({ theme }) => genTokens(theme.codeBlock.tokens)}
110
+ .token.comment,
111
+ .token.prolog,
112
+ .token.doctype,
113
+ .token.cdata {
114
+ color: #999988;
115
+ font-style: italic;
116
+ }
117
+ .token.namespace {
118
+ opacity: 0.7;
119
+ }
120
+ .token.string,
121
+ .token.attr-value {
122
+ color: #e3116c;
123
+ }
124
+ .token.punctuation,
125
+ .token.operator {
126
+ color: #393a34; /* no highlight */
127
+ }
128
+ .token.entity,
129
+ .token.url,
130
+ .token.symbol,
131
+ .token.number,
132
+ .token.boolean,
133
+ .token.variable,
134
+ .token.constant,
135
+ .token.property,
136
+ .token.regex,
137
+ .token.inserted {
138
+ color: #36acaa;
139
+ }
140
+ .token.atrule,
141
+ .token.keyword,
142
+ .token.attr-name,
143
+ .language-autohotkey .token.selector {
144
+ color: #00a4db;
145
+ }
146
+ .token.function,
147
+ .token.deleted,
148
+ .language-autohotkey .token.tag {
149
+ color: #9a050f;
150
+ }
151
+ .token.tag,
152
+ .token.selector,
153
+ .language-autohotkey .token.keyword {
154
+ color: #00009f;
155
+ }
156
+
157
+ ${generateCodeBlockTokens()}
288
158
  }
289
159
  `;
@@ -1,6 +1,6 @@
1
1
  import styled, { css, FlattenSimpleInterpolation } from 'styled-components';
2
2
 
3
- import { typography, typographyTokens, ITypography } from '@theme/ui/Typography';
3
+ import { typography } from '@theme/utils';
4
4
 
5
5
  export const baseTable = css`
6
6
  table {
@@ -68,19 +68,6 @@ export const baseTable = css`
68
68
  }
69
69
  `;
70
70
 
71
- export function margins(theme: ITypography): FlattenSimpleInterpolation | string {
72
- if (!theme) return '';
73
-
74
- return css`
75
- ${{
76
- marginTop: theme.marginTop || theme.marginVertical || '',
77
- marginBottom: theme.marginBottom || theme.marginVertical || '',
78
- marginLeft: theme.marginLeft || theme.marginHorizontal || '',
79
- marginRight: theme.marginRight || theme.marginHorizontal || '',
80
- }}
81
- `;
82
- }
83
-
84
71
  // TODO: Can users specify another className or we should hardcode it?
85
72
  export function headingAnchor(className = 'anchor'): FlattenSimpleInterpolation {
86
73
  return css`
@@ -220,8 +207,8 @@ export const StyledMarkdown = styled.main.attrs(() => ({
220
207
  }
221
208
 
222
209
  h1 {
223
- ${typography(typographyTokens.heading1)};
224
- ${margins(typographyTokens.heading1)};
210
+ ${typography('h1', 'h')};
211
+ margin: var(--h1-margin-top) var(--h1-margin-bottom);
225
212
  ${headingAnchor()};
226
213
 
227
214
  &:first-child {
@@ -230,32 +217,32 @@ export const StyledMarkdown = styled.main.attrs(() => ({
230
217
  }
231
218
 
232
219
  h2 {
233
- ${typography(typographyTokens.heading2)};
234
- ${margins(typographyTokens.heading2)};
220
+ ${typography('h2', 'h')};
221
+ margin: var(--h2-margin-top) var(--h2-margin-bottom);
235
222
  ${headingAnchor()};
236
223
  }
237
224
 
238
225
  h3 {
239
- ${typography(typographyTokens.heading3)};
240
- ${margins(typographyTokens.heading3)};
226
+ ${typography('h3', 'h')};
227
+ margin: var(--h3-margin-top) var(--h3-margin-bottom);
241
228
  ${headingAnchor()};
242
229
  }
243
230
 
244
231
  h4 {
245
- ${typography(typographyTokens.heading4)};
246
- ${margins(typographyTokens.heading4)};
232
+ ${typography('h4', 'h')};
233
+ margin: var(--h4-margin-top) var(--h4-margin-bottom);
247
234
  ${headingAnchor()};
248
235
  }
249
236
 
250
237
  h5 {
251
- ${typography(typographyTokens.heading5)};
252
- ${margins(typographyTokens.heading5)};
238
+ ${typography('h5', 'h')};
239
+ margin: var(--h5-margin-top) var(--h5-margin-bottom);
253
240
  ${headingAnchor()};
254
241
  }
255
242
 
256
243
  h6 {
257
- ${typography(typographyTokens.heading6)};
258
- ${margins(typographyTokens.heading6)};
244
+ ${typography('h6', 'h')};
245
+ margin: var(--h6-margin-top) var(--h6-margin-bottom);
259
246
  ${headingAnchor()};
260
247
  }
261
248
 
@@ -277,8 +264,7 @@ export const StyledMarkdown = styled.main.attrs(() => ({
277
264
  padding: var(--bloquote-padding-vertical) var(--bloquote-padding-horizontal);
278
265
  border-left: 4px solid var(--global-border-color);
279
266
  background-color: var(--bloquote-background-color);
280
-
281
- ${typography(typographyTokens.blockquote)};
267
+ color: var(--color-content);
282
268
 
283
269
  & > p:first-child {
284
270
  margin-top: 0;
@@ -3,7 +3,9 @@ import styled from 'styled-components';
3
3
  export const OperationBadge = styled.span.attrs((props: { type: string }) => ({
4
4
  className: `operation-type ${props.type}`,
5
5
  }))<{ type: string }>`
6
- display: inline-block;
6
+ display: inline-flex;
7
+ align-items: center;
8
+ justify-content: center;
7
9
  font-size: var(--http-badge-menu-font-size);
8
10
  font-family: var(--http-badge-font-family);
9
11
  font-weight: var(--http-badge-font-weight);
@@ -41,7 +43,8 @@ export const OperationBadge = styled.span.attrs((props: { type: string }) => ({
41
43
  background-color: var(--color-http-delete);
42
44
  }
43
45
 
44
- &.basic {
46
+ &.basic,
47
+ &.schema {
45
48
  background-color: var(--color-http-basic);
46
49
  }
47
50
 
@@ -5,11 +5,11 @@ import { usePageData } from '@portal/hooks/usePageData';
5
5
  import { Button } from '@theme/ui';
6
6
 
7
7
  interface NextPageType {
8
- nextPage: ResolvedNavLinkItem | null;
8
+ nextPage?: ResolvedNavLinkItem | null;
9
9
  }
10
10
 
11
11
  export function NextPageLink(): JSX.Element {
12
- const { nextPage }: NextPageType = usePageData();
12
+ const { nextPage }: NextPageType = usePageData() || {};
13
13
  if (!nextPage) {
14
14
  return <div>&nbsp;</div>;
15
15
  }
@@ -5,11 +5,11 @@ import { usePageData } from '@portal/hooks/usePageData';
5
5
  import { Button } from '@theme/ui';
6
6
 
7
7
  interface PreviousPageType {
8
- prevPage: ResolvedNavLinkItem | null;
8
+ prevPage?: ResolvedNavLinkItem | null;
9
9
  }
10
10
 
11
11
  export function PreviousPageLink(): JSX.Element {
12
- const { prevPage }: PreviousPageType = usePageData();
12
+ const { prevPage }: PreviousPageType = usePageData() || {};
13
13
  if (!prevPage) {
14
14
  return <div>&nbsp;</div>;
15
15
  }
@@ -21,7 +21,7 @@ export const ClearIcon = styled(Icon)`
21
21
  width: 0.5em;
22
22
  height: 0.5em;
23
23
  right: 1.2em;
24
- fill: var(--input-text-color);
24
+ fill: var(--search-input-text-color);
25
25
 
26
26
  ${({ theme }) => theme.mediaQueries.medium} {
27
27
  width: 0.625em;
@@ -4,16 +4,16 @@ export const FormInput = styled.input.attrs(() => ({
4
4
  'data-component-name': 'Search/Input',
5
5
  }))`
6
6
  padding: 1em 2.5em 1em 1em;
7
- background-color: var(--input-background-color);
8
- border-radius: var(--input-border-radius);
7
+ background-color: var(--search-input-background-color);
8
+ border-radius: var(--search-input-border-radius);
9
9
  border: none;
10
10
  outline: none;
11
- color: var(--input-text-color);
12
- font-size: var(--input-font-size);
13
- font-family: var(--input-font-family);
14
- line-height: var(--input-line-height);
11
+ color: var(--search-input-text-color);
12
+ font-size: var(--search-input-font-size);
13
+ font-family: var(--search-input-font-family);
14
+ line-height: var(--search-input-line-height);
15
15
 
16
16
  ::placeholder {
17
- color: var(--input-text-color);
17
+ color: var(--search-input-text-color);
18
18
  }
19
19
  `;
@@ -14,7 +14,7 @@ export const Popover = styled.div.attrs(() => ({
14
14
  overflow-y: auto;
15
15
  box-shadow: 0 16px 24px 2px rgba(0, 0, 0, 0.14), 0 6px 30px 5px rgba(0, 0, 0, 0.12),
16
16
  0 8px 10px -5px rgba(0, 0, 0, 0.4);
17
- background: var(--popover-backgrond-color);
17
+ background: var(--search-popover-backgrond-color);
18
18
  list-style: none;
19
- border-radius: var(--popover-border-radius);
19
+ border-radius: var(--search-popover-border-radius);
20
20
  `;
@@ -21,7 +21,7 @@ export const SearchIcon = styled(Icon)`
21
21
  width: 1em;
22
22
  height: 1em;
23
23
  right: 1em;
24
- fill: var(--input-text-color);
24
+ fill: var(--search-input-text-color);
25
25
  z-index: -1;
26
26
 
27
27
  ${({ theme }) => theme.mediaQueries.medium} {
@@ -25,7 +25,7 @@ export function SearchItem({ item }: SearchItemProps): JSX.Element {
25
25
  {item.httpVerb ? (
26
26
  <Operation>
27
27
  <OperationBadge type={item.httpVerb}>{item.httpVerb}</OperationBadge>
28
- {highlight(item.pathName)}
28
+ {item.pathName ? highlight(item.pathName) : null}
29
29
  </Operation>
30
30
  ) : null}
31
31
  <Title>{highlight(item.title)}</Title>
@@ -12,8 +12,7 @@ export function ApiCallItem({ item }: MenuItemProps): JSX.Element {
12
12
  <Wrapper data-component-name="Sidebar/ApiCallItem">
13
13
  <MenuLinkItem item={item}>
14
14
  <MenuItemLabel active={item.active}>
15
- {/* TODO: not sure item.httpVerb || 'event' is correct */}
16
- <Badge type={item.httpVerb || 'event'}>
15
+ <Badge type={item.httpVerb || ''}>
17
16
  {item.httpVerb === 'hook' ? 'event' : item.httpVerb}
18
17
  </Badge>
19
18
  {item.label}