@apify/docs-theme 1.0.5 → 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apify/docs-theme",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "files": [
package/src/config.js CHANGED
@@ -139,7 +139,7 @@ const themeConfig = ({
139
139
  additionalLanguages: ['docker', 'log'],
140
140
  },
141
141
  metadata: [],
142
- image: 'img/apify_og_SDK.png',
142
+ image: 'https://apify.com/img/og/docs.png',
143
143
  footer: {
144
144
  links: [
145
145
  {
@@ -1,7 +1,6 @@
1
1
  import React from 'react';
2
2
  import { useThemeConfig } from '@docusaurus/theme-common';
3
3
  import { usePluginData } from '@docusaurus/useGlobalData';
4
- import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
5
4
  import {
6
5
  splitNavbarItems,
7
6
  } from '@docusaurus/theme-common/internal';
@@ -16,9 +15,7 @@ import styles from './styles.module.css';
16
15
  function NavbarItems({ items }) {
17
16
  return (
18
17
  <>
19
- {items.map((item, i) => (
20
- <NavbarItem {...item} key={i}/>
21
- ))}
18
+ {items.map((item, i) => <NavbarItem {...item} key={i}/>)}
22
19
  </>
23
20
  );
24
21
  }
@@ -29,8 +26,10 @@ function NavbarContentLayout({
29
26
  }) {
30
27
  return (
31
28
  <div className="navbar__inner">
32
- <div className="navbar__items">{left}</div>
33
- <div className="navbar__items navbar__items--right">{right}</div>
29
+ <div className="navbar__container">
30
+ <div className="navbar__items">{left}</div>
31
+ <div className="navbar__items navbar__items--right">{right}</div>
32
+ </div>
34
33
  </div>
35
34
  );
36
35
  }
@@ -39,15 +38,14 @@ function SubNavbar() {
39
38
  const { options: { subNavbar } } = usePluginData('@apify/docs-theme');
40
39
  return (
41
40
  subNavbar ? (
42
- <div className="navbar__inner">
43
- <div className="navbar__items">
44
- <NavbarItems items={[
45
- {
46
- label: subNavbar.title,
47
- to: '/',
48
- },
49
- ...subNavbar.items,
50
- ]}/>
41
+ <div className="navbar__inner navbar__sub">
42
+ <div className="navbar__container">
43
+ <div className="navbar__items">
44
+ <div className="navbar__sub--title">
45
+ <NavbarItem label={subNavbar.title} to="/"/>
46
+ </div>
47
+ <NavbarItems items={subNavbar.items}/>
48
+ </div>
51
49
  </div>
52
50
  </div>
53
51
  ) : null
@@ -62,7 +60,7 @@ export default function NavbarContent() {
62
60
  <div
63
61
  style={{
64
62
  width: '100%',
65
- height: '100%',
63
+ height: 'fit-content',
66
64
  alignItems: 'center',
67
65
  display: 'flex',
68
66
  flexDirection: 'column',
@@ -3,7 +3,8 @@ import Link from '@docusaurus/Link';
3
3
  import useBaseUrl from '@docusaurus/useBaseUrl';
4
4
  import isInternalUrl from '@docusaurus/isInternalUrl';
5
5
  import { useLocation } from '@docusaurus/router';
6
- import { isRegexpStringMatch } from '@docusaurus/theme-common';
6
+ import { isRegexpStringMatch, useThemeConfig } from '@docusaurus/theme-common';
7
+ import { usePluginData } from '@docusaurus/useGlobalData';
7
8
 
8
9
  export default function NavbarNavLink({
9
10
  activeBasePath,
@@ -16,6 +17,9 @@ export default function NavbarNavLink({
16
17
  prependBaseUrlToHref,
17
18
  ...props
18
19
  }) {
20
+ const { navbar: { items = [] } } = useThemeConfig();
21
+ const { options: { subNavbar } } = usePluginData('@apify/docs-theme');
22
+ const allItems = [...items, ...(subNavbar?.items || [])];
19
23
  const location = useLocation();
20
24
  // TODO all this seems hacky
21
25
  // {to: 'version'} should probably be forbidden, in favor of {to: '/version'}
@@ -39,13 +43,21 @@ export default function NavbarNavLink({
39
43
  </>
40
44
  ),
41
45
  };
46
+
47
+ // If the item is a dropdown, look for any of its children that match the current path
48
+ const dropDownHasActiveItem = location.pathname !== '/' && allItems
49
+ .filter((item) => item.type === 'dropdown')
50
+ .filter((item) => item.label === label)
51
+ .reduce((nestedItems, item) => [...nestedItems, ...item.items], [])
52
+ .some((item) => (item.to || item.href).endsWith(location.pathname));
53
+
42
54
  if (href) {
43
55
  return (
44
56
  <Link
45
57
  href={prependBaseUrlToHref ? normalizedHref : href}
46
58
  {...props}
47
59
  {...(activeBaseUrl && {
48
- className: location.pathname.startsWith(`/${activeBasePath}`)
60
+ className: location.pathname.startsWith(`/${activeBasePath}`) || dropDownHasActiveItem
49
61
  ? 'navbar__item navbar__link navbar__link--active'
50
62
  : 'navbar__item navbar__link',
51
63
  })}
@@ -53,17 +65,19 @@ export default function NavbarNavLink({
53
65
  />
54
66
  );
55
67
  }
68
+
56
69
  return (
57
70
  <Link
58
71
  to={toUrl}
59
72
  isNavLink
60
73
  {...((activeBasePath || activeBaseRegex) && {
61
74
  isActive: (_match, location) => (activeBaseRegex
62
- ? isRegexpStringMatch(activeBaseRegex, location.pathname)
75
+ ? isRegexpStringMatch(activeBaseRegex, location.pathname) || dropDownHasActiveItem
63
76
  : location.pathname.startsWith(activeBaseUrl)),
64
77
  })}
65
78
  {...props}
66
79
  {...linkContentProps}
80
+ isActive={() => true}
67
81
  />
68
82
  );
69
83
  }
@@ -16,6 +16,14 @@ html[data-theme='dark'] {
16
16
 
17
17
  --docusaurus-highlighted-code-line-bg: rgba(255, 255, 255, 0.1);
18
18
  --docsearch-text-color: #8d92af;
19
+
20
+ --color-Neutral_Background: #1A1B21;
21
+ --color-Neutral_BackgroundMuted: #252832;
22
+ --color-Neutral_SeparatorSubtle: #343847;
23
+ --color-Neutral_ChipBackgroundActive: #8C93A8;
24
+ --color-Neutral_Text: #F3F4FA;
25
+ --color-Neutral_TextMuted: #B2B8CC;
26
+ --color-Neutral_Hover: #2A2D39;
19
27
  }
20
28
 
21
29
  :root {
@@ -56,6 +64,14 @@ html[data-theme='dark'] {
56
64
  --docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.1);
57
65
 
58
66
  --ifm-heading-color: #242736;
67
+
68
+ --color-Neutral_Background: #ffffff;
69
+ --color-Neutral_BackgroundMuted: #f8f9fc;
70
+ --color-Neutral_SeparatorSubtle: #e0e3f2;
71
+ --color-Neutral_ChipBackgroundActive: #C1C6DD;
72
+ --color-Neutral_Text: #242836;
73
+ --color-Neutral_TextMuted: #3F475D;
74
+ --color-Neutral_Hover: #F2F3FB;
59
75
  }
60
76
 
61
77
  @font-face {
@@ -85,13 +101,21 @@ html[data-theme='dark'] {
85
101
 
86
102
  .navbar__inner {
87
103
  /* .container */
104
+ padding: 10px var(--ifm-spacing-horizontal);
105
+ width: 100%;
106
+ background: var(--color-Neutral_Background);
107
+ }
108
+
109
+ .navbar__container {
88
110
  max-width: calc(var(--max-layout-width) - 32px);
89
- padding: 0 var(--ifm-spacing-horizontal);
111
+ display: flex;
112
+ margin: 0 auto;
90
113
  width: 100%;
91
114
  }
92
115
 
93
116
  .navbar__item.dropdown {
94
117
  padding: 0;
118
+ display: none;
95
119
  }
96
120
 
97
121
  .DocSearch-Button-Placeholder {
@@ -127,6 +151,8 @@ html[data-theme="dark"] .DocSearch-Button .DocSearch-Search-Icon {
127
151
  }
128
152
 
129
153
  .navbar {
154
+ padding: 0;
155
+ /* height: fit-content; */
130
156
  height: auto;
131
157
  }
132
158
 
@@ -161,14 +187,20 @@ aside > div > a > b {
161
187
  position: relative;
162
188
  vertical-align: top;
163
189
  width: 0.4em;
164
- top: 9px;
190
+ top: 7px;
165
191
  transform: rotate(135deg);
192
+ transition: all ease-in 0.2s;
193
+ margin-right: 6px;
194
+ }
195
+
196
+ .dropdown:hover .navbar__link::after {
197
+ transform: rotate(-45deg);
198
+ top: 10px;
166
199
  }
167
200
 
168
201
  .navbar .icon {
169
202
  font-size: 0;
170
203
  padding: 4px;
171
- margin-left: 20px;
172
204
  line-height: 0;
173
205
  }
174
206
 
@@ -201,6 +233,46 @@ aside svg[class*=iconExternalLink] {
201
233
  display: none;
202
234
  }
203
235
 
236
+ .navbar__items {
237
+ gap: 6px;
238
+ }
239
+
240
+ .navbar__item, .menu__link {
241
+ border-radius: 8px;
242
+ color: var(--color-Neutral_TextMuted);
243
+ padding: 4px 8px;
244
+ font-size: 14px;
245
+ line-height: 24.4px;
246
+ transition: all ease-in 0.2s;
247
+ }
248
+
249
+ .navbar__link:hover, .navbar__link--active:hover {
250
+ color: unset;
251
+ }
252
+
253
+ .navbar__sub {
254
+ display: none;
255
+ background-color: var(--color-Neutral_BackgroundMuted);
256
+ border: 1px solid var(--color-Neutral_SeparatorSubtle);
257
+ }
258
+
259
+ .navbar__sub--title {
260
+ display: flex;
261
+ align-items: center;
262
+ width: 160px;
263
+ justify-content: flex-end;
264
+ margin-right: 40px;
265
+ position: relative;
266
+ }
267
+
268
+ .navbar__sub--title::after {
269
+ content: "";
270
+ height: 20px;
271
+ border-right: 1px solid var(--color-Neutral_SeparatorSubtle);
272
+ position: absolute;
273
+ right: -32px;
274
+ }
275
+
204
276
  header.hero div[class^=heroButtons] {
205
277
  justify-content: inherit;
206
278
  }
@@ -233,11 +305,24 @@ nav.navbar .dropdown__menu {
233
305
  }
234
306
 
235
307
  .navbar__logo {
308
+ display: none;
236
309
  width: 11rem;
237
310
  height: 3rem;
238
311
  padding: 10px 0;
239
312
  }
240
313
 
314
+ .navbar-sidebar .navbar__logo {
315
+ display: initial;
316
+ }
317
+
318
+ .navbar-sidebar .toggle_theme-src-theme-ColorModeToggle-styles-module {
319
+ display: none;
320
+ }
321
+
322
+ .navbar-sidebar div[class*="toggle_apify-docs"] {
323
+ display: none;
324
+ }
325
+
241
326
  .navbar__link.subnav {
242
327
  font-size: 0.8em;
243
328
  padding: 5px;
@@ -292,6 +377,10 @@ html.plugin-docs .theme-doc-markdown h3 {
292
377
  line-height: 24px;
293
378
  }
294
379
 
380
+ .navbar-sidebar .menu__link.icon {
381
+ display: none;
382
+ }
383
+
295
384
  .theme-doc-sidebar-menu .menu__link,
296
385
  .theme-doc-toc-desktop .table-of-contents .toc-highlight {
297
386
  height: auto;
@@ -311,8 +400,7 @@ html.plugin-docs .theme-doc-markdown h3 {
311
400
  font-weight: 700;
312
401
  }
313
402
 
314
- .theme-doc-sidebar-menu .menu__list-item-collapsible,
315
- .theme-doc-sidebar-menu .menu__list-item-collapsible--active {
403
+ .theme-doc-sidebar-menu .menu__list-item-collapsible {
316
404
  background: none;
317
405
  }
318
406
 
@@ -320,6 +408,18 @@ html.plugin-docs .theme-doc-markdown h3 {
320
408
  font-weight: 700;
321
409
  }
322
410
 
411
+ .navbar__link--active,
412
+ .theme-doc-sidebar-menu.menu__list .menu__link--active,
413
+ .theme-doc-sidebar-menu.menu__list .menu__list-item-collapsible--active
414
+ {
415
+ color: var(--color-Neutral_Text);
416
+ background: var(--color-Neutral_ChipBackgroundActive);
417
+ }
418
+
419
+ .navbar__link:not(.navbar__link--active):hover {
420
+ background: var(--color-Neutral_Hover);
421
+ }
422
+
323
423
  html[data-theme='dark'] .theme-doc-sidebar-menu .menu__link,
324
424
  html[data-theme='dark'] .theme-doc-toc-desktop .table-of-contents .toc-highlight {
325
425
  color: #b3b8d2;
@@ -345,11 +445,65 @@ html[data-theme='dark'] .theme-doc-toc-desktop .table-of-contents .table-of-cont
345
445
  display: none;
346
446
  }
347
447
 
348
- @media (min-width: 997px) and (max-width: 1250px) {
448
+ nav.navbar {
449
+ transition: transform var(--ifm-transition-slow) ease;
450
+ }
451
+
452
+ nav.navbar[class*="navbarHidden"]{
453
+ transform: translate3d(0, calc(-210%), 0);
454
+ }
455
+
456
+ .navbar__items--right a.icon,
457
+ div[class*="colorModeToggle"]
458
+ {
459
+ display: initial;
460
+ }
461
+
462
+ div[class*="searchBox"] {
463
+ padding-left: 0;
464
+ position: unset;
465
+ }
466
+
467
+ .menu__link.navbar__item {
468
+ padding: 4px 8px;
469
+ }
470
+
471
+ .menu__list-item {
472
+ min-height: 33px;
473
+ }
474
+
475
+ .menu__link, .menu__list-item > .navbar__item {
476
+ display: flex;
477
+ }
478
+
479
+ @media (min-width: 480px) {
480
+ .navbar__logo {
481
+ display: initial;
482
+ }
483
+ }
484
+
485
+
486
+ @media (min-width: 997px) {
487
+ .navbar__sub {
488
+ display: block;
489
+ }
490
+
491
+ .navbar__item.dropdown {
492
+ display: flex;
493
+ }
494
+ }
495
+
496
+ @media (min-width: 1130px) {
497
+ .navbar__items {
498
+ gap: 20px;
499
+ }
500
+ }
501
+
502
+ /* @media (min-width: 997px) and (max-width: 1250px) {
349
503
  .navbar__items--right a.icon {
350
504
  display: none;
351
505
  }
352
- }
506
+ } */
353
507
 
354
508
  @media (min-width: 997px) and (max-width: 1130px) {
355
509
  .navbar__link.changelog {