@apify/docs-theme 1.0.6 → 1.0.8

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.6",
3
+ "version": "1.0.8",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "files": [
@@ -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,13 +65,14 @@ 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}
@@ -16,6 +16,20 @@ 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
+ /* TRON colors */
21
+ --color-Neutral_Text: #F3F4FA;
22
+ --color-Neutral_TextMuted: #b0b8d1;
23
+ --color-Neutral_Border: #d1d5e4;
24
+ --color-Neutral_Hover: #2a2d39;
25
+ --color-Neutral_Background: #1A1B21;
26
+ --color-Neutral_BackgroundMuted: #252832;
27
+ --color-Neutral_ChipBackground: #555d76;
28
+ --color-Neutral_ChipBackgroundActive: #8C93A8;
29
+ --color-Neutral_SeparatorSubtle: #31384d;
30
+ --color-Primary_ChipText: #8ebcff;
31
+ --color-Primary_ChipBackground: #1a3a78;
32
+ --color-Primary_TextInteractive: #6f9dff;
19
33
  }
20
34
 
21
35
  :root {
@@ -56,6 +70,20 @@ html[data-theme='dark'] {
56
70
  --docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.1);
57
71
 
58
72
  --ifm-heading-color: #242736;
73
+
74
+ /* TRON colors */
75
+ --color-Neutral_Text: #242836;
76
+ --color-Neutral_TextMuted: #3f475d;
77
+ --color-Neutral_Border: #d0d5e9;
78
+ --color-Neutral_Hover: #f3f4fa;
79
+ --color-Neutral_Background: #ffffff;
80
+ --color-Neutral_BackgroundMuted: #f8f9fc;
81
+ --color-Neutral_ChipBackground: #e0e3f2;
82
+ --color-Neutral_ChipBackgroundActive: #C1C6DD;
83
+ --color-Neutral_SeparatorSubtle: #e0e3f2;
84
+ --color-Primary_ChipText: #1A57DA;
85
+ --color-Primary_ChipBackground: #E1EAFF;
86
+ --color-Primary_TextInteractive: #3970d7;
59
87
  }
60
88
 
61
89
  @font-face {
@@ -85,13 +113,21 @@ html[data-theme='dark'] {
85
113
 
86
114
  .navbar__inner {
87
115
  /* .container */
116
+ padding: 10px var(--ifm-spacing-horizontal);
117
+ width: 100%;
118
+ background: var(--color-Neutral_Background);
119
+ }
120
+
121
+ .navbar__container {
88
122
  max-width: calc(var(--max-layout-width) - 32px);
89
- padding: 0 var(--ifm-spacing-horizontal);
123
+ display: flex;
124
+ margin: 0 auto;
90
125
  width: 100%;
91
126
  }
92
127
 
93
128
  .navbar__item.dropdown {
94
129
  padding: 0;
130
+ display: none;
95
131
  }
96
132
 
97
133
  .DocSearch-Button-Placeholder {
@@ -127,6 +163,8 @@ html[data-theme="dark"] .DocSearch-Button .DocSearch-Search-Icon {
127
163
  }
128
164
 
129
165
  .navbar {
166
+ padding: 0;
167
+ /* height: fit-content; */
130
168
  height: auto;
131
169
  }
132
170
 
@@ -161,14 +199,20 @@ aside > div > a > b {
161
199
  position: relative;
162
200
  vertical-align: top;
163
201
  width: 0.4em;
164
- top: 9px;
202
+ top: 7px;
165
203
  transform: rotate(135deg);
204
+ transition: all ease-in 0.2s;
205
+ margin-right: 6px;
206
+ }
207
+
208
+ .dropdown:hover .navbar__link::after {
209
+ transform: rotate(-45deg);
210
+ top: 10px;
166
211
  }
167
212
 
168
213
  .navbar .icon {
169
214
  font-size: 0;
170
215
  padding: 4px;
171
- margin-left: 20px;
172
216
  line-height: 0;
173
217
  }
174
218
 
@@ -201,6 +245,46 @@ aside svg[class*=iconExternalLink] {
201
245
  display: none;
202
246
  }
203
247
 
248
+ .navbar__items {
249
+ gap: 6px;
250
+ }
251
+
252
+ .navbar__item, .menu__link, .navbar__link {
253
+ border-radius: 8px;
254
+ color: var(--color-Neutral_TextMuted);
255
+ padding: 4px 8px;
256
+ font-size: 14px;
257
+ line-height: 24.4px;
258
+ transition: all ease-in 0.2s;
259
+ }
260
+
261
+ .navbar__link:hover, .navbar__link--active:hover {
262
+ color: unset;
263
+ }
264
+
265
+ .navbar__sub {
266
+ display: none;
267
+ background-color: var(--color-Neutral_BackgroundMuted);
268
+ border: 1px solid var(--color-Neutral_SeparatorSubtle);
269
+ }
270
+
271
+ .navbar__sub--title {
272
+ display: flex;
273
+ align-items: center;
274
+ width: 160px;
275
+ justify-content: flex-end;
276
+ margin-right: 40px;
277
+ position: relative;
278
+ }
279
+
280
+ .navbar__sub--title::after {
281
+ content: "";
282
+ height: 20px;
283
+ border-right: 1px solid var(--color-Neutral_SeparatorSubtle);
284
+ position: absolute;
285
+ right: -32px;
286
+ }
287
+
204
288
  header.hero div[class^=heroButtons] {
205
289
  justify-content: inherit;
206
290
  }
@@ -233,11 +317,24 @@ nav.navbar .dropdown__menu {
233
317
  }
234
318
 
235
319
  .navbar__logo {
320
+ display: none;
236
321
  width: 11rem;
237
322
  height: 3rem;
238
323
  padding: 10px 0;
239
324
  }
240
325
 
326
+ .navbar-sidebar .navbar__logo {
327
+ display: initial;
328
+ }
329
+
330
+ .navbar-sidebar .toggle_theme-src-theme-ColorModeToggle-styles-module {
331
+ display: none;
332
+ }
333
+
334
+ .navbar-sidebar div[class*="toggle_apify-docs"] {
335
+ display: none;
336
+ }
337
+
241
338
  .navbar__link.subnav {
242
339
  font-size: 0.8em;
243
340
  padding: 5px;
@@ -292,6 +389,10 @@ html.plugin-docs .theme-doc-markdown h3 {
292
389
  line-height: 24px;
293
390
  }
294
391
 
392
+ .navbar-sidebar .menu__link.icon {
393
+ display: none;
394
+ }
395
+
295
396
  .theme-doc-sidebar-menu .menu__link,
296
397
  .theme-doc-toc-desktop .table-of-contents .toc-highlight {
297
398
  height: auto;
@@ -311,8 +412,7 @@ html.plugin-docs .theme-doc-markdown h3 {
311
412
  font-weight: 700;
312
413
  }
313
414
 
314
- .theme-doc-sidebar-menu .menu__list-item-collapsible,
315
- .theme-doc-sidebar-menu .menu__list-item-collapsible--active {
415
+ .theme-doc-sidebar-menu .menu__list-item-collapsible {
316
416
  background: none;
317
417
  }
318
418
 
@@ -320,6 +420,18 @@ html.plugin-docs .theme-doc-markdown h3 {
320
420
  font-weight: 700;
321
421
  }
322
422
 
423
+ .navbar__link--active,
424
+ .theme-doc-sidebar-menu.menu__list .menu__link--active,
425
+ .theme-doc-sidebar-menu.menu__list .menu__list-item-collapsible--active
426
+ {
427
+ color: var(--color-Neutral_Text);
428
+ background: var(--color-Neutral_ChipBackgroundActive);
429
+ }
430
+
431
+ .navbar__link:not(.navbar__link--active):hover {
432
+ background: var(--color-Neutral_Hover);
433
+ }
434
+
323
435
  html[data-theme='dark'] .theme-doc-sidebar-menu .menu__link,
324
436
  html[data-theme='dark'] .theme-doc-toc-desktop .table-of-contents .toc-highlight {
325
437
  color: #b3b8d2;
@@ -345,11 +457,65 @@ html[data-theme='dark'] .theme-doc-toc-desktop .table-of-contents .table-of-cont
345
457
  display: none;
346
458
  }
347
459
 
348
- @media (min-width: 997px) and (max-width: 1250px) {
460
+ nav.navbar {
461
+ transition: transform var(--ifm-transition-slow) ease;
462
+ }
463
+
464
+ nav.navbar[class*="navbarHidden"]{
465
+ transform: translate3d(0, calc(-210%), 0);
466
+ }
467
+
468
+ .navbar__items--right a.icon,
469
+ div[class*="colorModeToggle"]
470
+ {
471
+ display: initial;
472
+ }
473
+
474
+ div[class*="searchBox"] {
475
+ padding-left: 0;
476
+ position: unset;
477
+ }
478
+
479
+ .menu__link.navbar__item {
480
+ padding: 4px 8px;
481
+ }
482
+
483
+ .menu__list-item {
484
+ min-height: 33px;
485
+ }
486
+
487
+ .menu__link, .menu__list-item > .navbar__item {
488
+ display: flex;
489
+ }
490
+
491
+ @media (min-width: 480px) {
492
+ .navbar__logo {
493
+ display: initial;
494
+ }
495
+ }
496
+
497
+
498
+ @media (min-width: 997px) {
499
+ .navbar__sub {
500
+ display: block;
501
+ }
502
+
503
+ .navbar__item.dropdown {
504
+ display: flex;
505
+ }
506
+ }
507
+
508
+ @media (min-width: 1130px) {
509
+ .navbar__items {
510
+ gap: 20px;
511
+ }
512
+ }
513
+
514
+ /* @media (min-width: 997px) and (max-width: 1250px) {
349
515
  .navbar__items--right a.icon {
350
516
  display: none;
351
517
  }
352
- }
518
+ } */
353
519
 
354
520
  @media (min-width: 997px) and (max-width: 1130px) {
355
521
  .navbar__link.changelog {
@@ -380,3 +546,44 @@ html .table-of-contents {
380
546
  html .table-of-contents ul {
381
547
  border-left: 2px solid #dfe2f5;
382
548
  }
549
+
550
+ .actionLink {
551
+ font-weight: 700;
552
+ font-size: 20px;
553
+ line-height: 32px;
554
+ color: var(--color-Neutral_TextMuted);
555
+ border-bottom: 2px solid var(--color-Neutral_TextMuted);
556
+ display: inline-flex;
557
+ -webkit-box-align: center;
558
+ align-items: center;
559
+
560
+ }
561
+
562
+ .actionLink:hover {
563
+ color: var(--color-Primary_TextInteractive);
564
+ border-bottom: 2px solid var(--color-Primary_TextInteractive);
565
+ }
566
+
567
+ html[data-theme='dark'] .actionLink::after {
568
+ background-image: url('/static/img/arrow-right-light.svg');
569
+ }
570
+
571
+ html[data-theme='dark'] .actionLink:hover::after {
572
+ background-image: url('/static/img/arrow-right-primary-light.svg');
573
+ }
574
+
575
+ .actionLink::after {
576
+ content: " ";
577
+ display: block;
578
+ background-image: url('/static/img/arrow-right.svg');
579
+ background-size: 15px 15px;
580
+ height: 15px;
581
+ width: 15px;
582
+ margin-left: 4px;
583
+ transition: margin 200ms ease-in-out;
584
+ }
585
+
586
+ .actionLink:hover::after {
587
+ background-image: url('/static/img/arrow-right-primary.svg');
588
+ margin-left: 8px;
589
+ }