@apify/docs-theme 1.0.4 → 1.0.6

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,10 +1,11 @@
1
1
  {
2
2
  "name": "@apify/docs-theme",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "files": [
7
- "src"
7
+ "src",
8
+ "types"
8
9
  ],
9
10
  "scripts": {
10
11
  "test": "echo \"Error: no test specified\" && exit 1",
@@ -15,6 +16,7 @@
15
16
  "license": "ISC",
16
17
  "dependencies": {
17
18
  "@docusaurus/theme-common": "^2.2.0",
18
- "babel-loader": "^9.1.0"
19
+ "babel-loader": "^9.1.0",
20
+ "prism-react-renderer": "^1.3.5"
19
21
  }
20
22
  }
package/src/config.js ADDED
@@ -0,0 +1,218 @@
1
+ const absoluteUrl = process.env.LOCAL ? 'http://docs-v2.apify.loc' : 'https://docs-v2.apify.com';
2
+
3
+ const themeConfig = ({
4
+ docs: {
5
+ versionPersistence: 'localStorage',
6
+ sidebar: {
7
+ hideable: true,
8
+ },
9
+ },
10
+ navbar: {
11
+ hideOnScroll: true,
12
+ title: 'Apify Docs',
13
+ logo: {
14
+ src: 'img/apify_sdk.svg',
15
+ srcDark: 'img/apify_sdk_white.svg',
16
+ href: absoluteUrl,
17
+ target: '_self',
18
+ },
19
+ items: [
20
+ {
21
+ label: 'Academy',
22
+ href: `${absoluteUrl}/academy`,
23
+ activeBasePath: 'academy',
24
+ position: 'left',
25
+ target: '_self',
26
+ rel: 'dofollow',
27
+ },
28
+ {
29
+ label: 'Platform',
30
+ href: `${absoluteUrl}/platform`,
31
+ className: 'navbar__active',
32
+ activeBasePath: 'platform',
33
+ position: 'left',
34
+ target: '_self',
35
+ rel: 'dofollow',
36
+ },
37
+ {
38
+ label: 'API',
39
+ type: 'dropdown',
40
+ activeBasePath: 'api',
41
+ position: 'left',
42
+ items: [
43
+ {
44
+ label: 'Reference',
45
+ // TODO
46
+ href: 'https://docs.apify.com/api/v2',
47
+ },
48
+ {
49
+ label: 'Client for JavaScript',
50
+ href: `${absoluteUrl}/client-js/`, // we need a trailing slash here, we'd get redirected there anyway
51
+ target: '_self',
52
+ rel: 'dofollow',
53
+ },
54
+ {
55
+ label: 'Client for Python',
56
+ href: `${absoluteUrl}/client-python/`, // we need a trailing slash here, we'd get redirected there anyway
57
+ target: '_self',
58
+ rel: 'dofollow',
59
+ },
60
+ ],
61
+ },
62
+ {
63
+ label: 'SDK',
64
+ type: 'dropdown',
65
+ activeBasePath: 'sdk',
66
+ position: 'left',
67
+ items: [
68
+ {
69
+ label: 'SDK for JavaScript',
70
+ href: `${absoluteUrl}/sdk-js/`, // we need a trailing slash here, we'd get redirected there anyway
71
+ target: '_self',
72
+ rel: 'dofollow',
73
+ },
74
+ {
75
+ label: 'SDK for Python',
76
+ href: `${absoluteUrl}/sdk-python/`, // we need a trailing slash here, we'd get redirected there anyway
77
+ target: '_self',
78
+ rel: 'dofollow',
79
+ },
80
+ ],
81
+ },
82
+ {
83
+ label: 'CLI',
84
+ href: `${absoluteUrl}/cli/`, // we need a trailing slash here, we'd get redirected there anyway
85
+ position: 'left',
86
+ target: '_self',
87
+ rel: 'dofollow',
88
+ },
89
+ {
90
+ label: 'Open Source',
91
+ type: 'dropdown',
92
+ position: 'left',
93
+ className: 'navbar__item',
94
+ items: [
95
+ {
96
+ label: 'Crawlee',
97
+ href: 'https://crawlee.dev',
98
+ rel: 'dofollow',
99
+ },
100
+ {
101
+ label: 'Got Scraping',
102
+ href: 'https://github.com/apify/got-scraping',
103
+ },
104
+ {
105
+ label: 'Fingerprint Suite',
106
+ href: 'https://github.com/apify/fingerprint-suite',
107
+ },
108
+ {
109
+ label: 'See our GitHub',
110
+ href: 'https://github.com/apify',
111
+ },
112
+ ],
113
+ },
114
+ {
115
+ href: 'https://github.com/apify',
116
+ label: 'GitHub',
117
+ title: 'See our GitHub',
118
+ position: 'right',
119
+ className: 'icon',
120
+ },
121
+ {
122
+ href: 'https://discord.com/invite/jyEM2PRvMU',
123
+ label: 'Discord',
124
+ title: 'Chat on Discord',
125
+ position: 'right',
126
+ className: 'icon',
127
+ },
128
+ ],
129
+ },
130
+ colorMode: {
131
+ defaultMode: 'light',
132
+ disableSwitch: false,
133
+ respectPrefersColorScheme: true,
134
+ },
135
+ prism: {
136
+ defaultLanguage: 'typescript',
137
+ theme: require('prism-react-renderer/themes/github'),
138
+ darkTheme: require('prism-react-renderer/themes/dracula'),
139
+ additionalLanguages: ['docker', 'log'],
140
+ },
141
+ metadata: [],
142
+ image: 'https://apify.com/img/og/docs.png',
143
+ footer: {
144
+ links: [
145
+ {
146
+ title: 'Docs',
147
+ items: [
148
+ {
149
+ label: 'Academy',
150
+ to: 'academy',
151
+ },
152
+ {
153
+ label: 'Platform',
154
+ to: 'platform',
155
+ },
156
+ ],
157
+ },
158
+ {
159
+ title: 'Community',
160
+ items: [
161
+ {
162
+ label: 'Discord',
163
+ href: 'https://discord.com/invite/jyEM2PRvMU',
164
+ },
165
+ {
166
+ label: 'Stack Overflow',
167
+ href: 'https://stackoverflow.com/questions/tagged/apify',
168
+ },
169
+ {
170
+ label: 'Twitter',
171
+ href: 'https://twitter.com/apify',
172
+ },
173
+ ],
174
+ },
175
+ {
176
+ title: 'More',
177
+ items: [
178
+ {
179
+ label: 'Apify Platform',
180
+ href: 'https://apify.com',
181
+ },
182
+ {
183
+ label: 'Crawlee',
184
+ href: 'https://crawlee.dev',
185
+ },
186
+ {
187
+ label: 'Docusaurus',
188
+ href: 'https://docusaurus.io',
189
+ },
190
+ {
191
+ label: 'GitHub',
192
+ href: 'https://github.com/apify',
193
+ },
194
+ ],
195
+ },
196
+ ],
197
+ logo: {
198
+ src: 'img/apify_logo.svg',
199
+ href: '/',
200
+ width: '60px',
201
+ height: '60px',
202
+ },
203
+ },
204
+ // TODO
205
+ algolia: {
206
+ appId: 'N8EOCSBQGH',
207
+ apiKey: 'b43e67a96ed18c7f63f5fd965906a96d', // search only (public) API key
208
+ indexName: 'apify_sdk',
209
+ algoliaOptions: {
210
+ facetFilters: ['version:VERSION'],
211
+ },
212
+ },
213
+ });
214
+
215
+ module.exports = {
216
+ themeConfig,
217
+ absoluteUrl,
218
+ };
package/src/index.js CHANGED
@@ -1,41 +1,7 @@
1
- function theme(
2
- context,
3
- options,
4
- ) {
5
- return {
6
- name: '@apify/docs-theme',
7
- getThemePath() {
8
- return '../src/theme';
9
- },
10
- getTypeScriptThemePath() {
11
- return '../src/theme';
12
- },
13
- contentLoaded({ actions }) {
14
- const { setGlobalData } = actions;
15
- setGlobalData({
16
- options,
17
- });
18
- },
19
- getClientModules() {
20
- return [
21
- require.resolve('./theme/custom.css'),
22
- ];
23
- },
24
- configureWebpack() {
25
- return {
26
- module: {
27
- rules: [
28
- {
29
- test: /(@apify\/|apify-)docs-theme\/src\/theme\/.*?\.jsx?$/,
30
- use: {
31
- loader: 'babel-loader',
32
- },
33
- },
34
- ],
35
- },
36
- };
37
- },
38
- };
39
- }
1
+ const config = require('./config.js');
2
+ const { theme } = require('./theme.js');
40
3
 
41
- exports.default = theme;
4
+ module.exports = {
5
+ default: theme,
6
+ config,
7
+ };
@@ -37,17 +37,16 @@ function NavbarContentLayout({
37
37
 
38
38
  function SubNavbar() {
39
39
  const { options: { subNavbar } } = usePluginData('@apify/docs-theme');
40
- const pageTitle = useDocusaurusContext().siteConfig.title;
41
40
  return (
42
41
  subNavbar ? (
43
42
  <div className="navbar__inner">
44
43
  <div className="navbar__items">
45
44
  <NavbarItems items={[
46
45
  {
47
- label: pageTitle,
46
+ label: subNavbar.title,
48
47
  to: '/',
49
48
  },
50
- ...subNavbar,
49
+ ...subNavbar.items,
51
50
  ]}/>
52
51
  </div>
53
52
  </div>
@@ -126,6 +126,10 @@ html[data-theme="dark"] .DocSearch-Button .DocSearch-Search-Icon {
126
126
  box-shadow: none !important;
127
127
  }
128
128
 
129
+ .navbar {
130
+ height: auto;
131
+ }
132
+
129
133
  .navbar, .main-wrapper {
130
134
  justify-content: center;
131
135
  }
package/src/theme.js ADDED
@@ -0,0 +1,43 @@
1
+ function theme(
2
+ context,
3
+ options,
4
+ ) {
5
+ return {
6
+ name: '@apify/docs-theme',
7
+ getThemePath() {
8
+ return '../src/theme';
9
+ },
10
+ getTypeScriptThemePath() {
11
+ return '../src/theme';
12
+ },
13
+ contentLoaded({ actions }) {
14
+ const { setGlobalData } = actions;
15
+ setGlobalData({
16
+ options,
17
+ });
18
+ },
19
+ getClientModules() {
20
+ return [
21
+ require.resolve('./theme/custom.css'),
22
+ ];
23
+ },
24
+ configureWebpack() {
25
+ return {
26
+ module: {
27
+ rules: [
28
+ {
29
+ test: /(@apify\/|apify-)docs-theme\/src\/theme\/.*?\.jsx?$/,
30
+ use: {
31
+ loader: 'babel-loader',
32
+ },
33
+ },
34
+ ],
35
+ },
36
+ };
37
+ },
38
+ };
39
+ }
40
+
41
+ module.exports = {
42
+ theme,
43
+ };
package/types/index.js ADDED
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @typedef {{
3
+ * subNavbar: {
4
+ * title: string,
5
+ * items: any[]
6
+ * }
7
+ * }} ThemeOptions
8
+ */
9
+
10
+ module.exports = {
11
+ types: {},
12
+ };