@apify/docs-theme 1.0.12 → 1.0.13

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.12",
3
+ "version": "1.0.13",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "files": [
@@ -0,0 +1,56 @@
1
+ import React from 'react';
2
+ import { useThemeConfig } from '@docusaurus/theme-common';
3
+ import useBaseUrl from '@docusaurus/useBaseUrl';
4
+ import { usePluginData } from '@docusaurus/useGlobalData';
5
+ import NavbarItem from '@theme/NavbarItem';
6
+
7
+ function useNavbarItems() {
8
+ // TODO temporary casting until ThemeConfig type is improved
9
+ return useThemeConfig().navbar.items;
10
+ }
11
+ // The primary menu displays the navbar items
12
+ export default function NavbarMobilePrimaryMenu() {
13
+ // const mobileSidebar = useNavbarMobileSidebar();
14
+ // TODO how can the order be defined for mobile?
15
+ // Should we allow providing a different list of items?
16
+ const items = useNavbarItems();
17
+ const baseUrl = useBaseUrl('.');
18
+ const { options: { subNavbar } } = usePluginData('@apify/docs-theme');
19
+ return (
20
+ <>
21
+ {
22
+ subNavbar ? <>
23
+ <NavbarItem
24
+ key={'title'}
25
+ mobile
26
+ href={baseUrl}
27
+ label={subNavbar.title}
28
+ />
29
+ <ul className="menu__list" style={{ paddingLeft: '1rem', marginBottom: '1rem', borderBottom: '1px solid #e0e0e0', paddingBottom: '1rem' }}>
30
+ {subNavbar.items.map((item, i) => (
31
+ <NavbarItem
32
+ key={i}
33
+ mobile
34
+ {...item}
35
+ />
36
+ ))}
37
+ </ul>
38
+ </> : null
39
+ }
40
+ <NavbarItem
41
+ key={'title2'}
42
+ mobile
43
+ label='Apify documentation'
44
+ />
45
+ <ul className="menu__list" style={{ paddingLeft: '1rem' }}>
46
+ {items.map((item, i) => (
47
+ <NavbarItem
48
+ mobile
49
+ {...item}
50
+ key={i}
51
+ />
52
+ ))}
53
+ </ul>
54
+ </>
55
+ );
56
+ }