@apify/docs-theme 1.0.150 → 1.0.152
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 +1 -1
- package/src/theme/NotFound.jsx +1 -1
- package/src/theme/SearchPage/index.js +11 -1
- package/src/theme/custom.css +11 -1
- package/static/js/custom.js +13 -9
package/package.json
CHANGED
package/src/theme/NotFound.jsx
CHANGED
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
} from '@docusaurus/theme-common/internal';
|
|
18
18
|
import Translate, { translate } from '@docusaurus/Translate';
|
|
19
19
|
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
|
20
|
+
import { useLocation } from '@docusaurus/router';
|
|
20
21
|
import {
|
|
21
22
|
useAlgoliaThemeConfig,
|
|
22
23
|
useSearchResultUrlProcessor,
|
|
@@ -120,6 +121,8 @@ function SearchPageContent() {
|
|
|
120
121
|
const documentsFoundPlural = useDocumentsFoundPlural();
|
|
121
122
|
const docsSearchVersionsHelpers = useDocsSearchVersionsHelpers();
|
|
122
123
|
const [searchQuery, setSearchQuery] = useSearchQueryString();
|
|
124
|
+
const location = useLocation();
|
|
125
|
+
const notFound = new URLSearchParams(location.search).get('not-found');
|
|
123
126
|
const initialSearchResultState = {
|
|
124
127
|
items: [],
|
|
125
128
|
query: null,
|
|
@@ -302,7 +305,14 @@ function SearchPageContent() {
|
|
|
302
305
|
</Head>
|
|
303
306
|
|
|
304
307
|
<div className="container margin-vert--lg">
|
|
305
|
-
|
|
308
|
+
{notFound ? (
|
|
309
|
+
<>
|
|
310
|
+
<h1>Page Not Found</h1>
|
|
311
|
+
<h2>{getTitle()}</h2>
|
|
312
|
+
</>
|
|
313
|
+
) : (
|
|
314
|
+
<h1>{getTitle()}</h1>
|
|
315
|
+
)}
|
|
306
316
|
|
|
307
317
|
<form className="row" onSubmit={(e) => e.preventDefault()}>
|
|
308
318
|
<div
|
package/src/theme/custom.css
CHANGED
|
@@ -990,7 +990,8 @@ html[data-theme='dark'] .actionLink:hover::after {
|
|
|
990
990
|
}
|
|
991
991
|
}
|
|
992
992
|
|
|
993
|
-
aside li.section-header > div > .menu__link
|
|
993
|
+
aside li.section-header > div > .menu__link,
|
|
994
|
+
aside li.section-header > ul > li > div > .menu__link {
|
|
994
995
|
text-transform: uppercase;
|
|
995
996
|
opacity: 0.8;
|
|
996
997
|
font-size: 16px;
|
|
@@ -998,6 +999,10 @@ aside li.section-header > div > .menu__link {
|
|
|
998
999
|
margin: 0;
|
|
999
1000
|
}
|
|
1000
1001
|
|
|
1002
|
+
aside li.section-header > div > .menu__link {
|
|
1003
|
+
font-size: 20px;
|
|
1004
|
+
}
|
|
1005
|
+
|
|
1001
1006
|
aside li.section-header.menu__list-item {
|
|
1002
1007
|
margin-top: 15px;
|
|
1003
1008
|
margin-bottom: 5px;
|
|
@@ -1011,6 +1016,11 @@ aside li.section-header > .menu__list {
|
|
|
1011
1016
|
padding-left: 0;
|
|
1012
1017
|
}
|
|
1013
1018
|
|
|
1019
|
+
.theme-doc-sidebar-menu > li.section-header > ul > li.theme-doc-sidebar-item-category-level-2 > .menu__list-item-collapsible:hover,
|
|
1020
|
+
.theme-doc-sidebar-menu > li.section-header > ul > li.theme-doc-sidebar-item-category-level-2 > .menu__list-item-collapsible--active {
|
|
1021
|
+
background: inherit !important;
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1014
1024
|
.beta-chip {
|
|
1015
1025
|
display: inline-block;
|
|
1016
1026
|
border: 1px solid #ccc;
|
package/static/js/custom.js
CHANGED
|
@@ -63,7 +63,7 @@ function scrollSidebarItemIntoView() {
|
|
|
63
63
|
|
|
64
64
|
// handles automatic scrolling of the API reference sidebar (openapi-docs)
|
|
65
65
|
function scrollOpenApiSidebarItemIntoView() {
|
|
66
|
-
const $li = document.querySelector(`
|
|
66
|
+
const $li = document.querySelector(`ul.theme-doc-sidebar-menu a.menu__link--active[href]`);
|
|
67
67
|
|
|
68
68
|
if (!$li) {
|
|
69
69
|
return;
|
|
@@ -76,27 +76,31 @@ function scrollOpenApiSidebarItemIntoView() {
|
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
function redirectOpenApiDocs() {
|
|
79
|
-
const { hash, pathname } = new URL(window.location.href);
|
|
79
|
+
const { hash, pathname, origin } = new URL(window.location.href);
|
|
80
80
|
|
|
81
81
|
// TODO change to '/api/v2'
|
|
82
82
|
if (pathname.replace(/\/$/, '') !== '/api/v2-new') {
|
|
83
83
|
return;
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
|
|
87
|
-
|
|
86
|
+
const sidebarItems = document.querySelectorAll('[data-altids]');
|
|
87
|
+
|
|
88
|
+
if (hash.startsWith('#/reference/') || hash.startsWith('#tag/')) {
|
|
89
|
+
let matched = false;
|
|
88
90
|
|
|
89
91
|
for (const item of sidebarItems) {
|
|
90
92
|
const ids = item.getAttribute('data-altids').split(',');
|
|
93
|
+
|
|
91
94
|
if (ids.find((variant) => variant === hash)) {
|
|
95
|
+
matched = true;
|
|
92
96
|
item.click();
|
|
97
|
+
setTimeout(() => scrollOpenApiSidebarItemIntoView(), 200);
|
|
93
98
|
}
|
|
94
99
|
}
|
|
95
|
-
}
|
|
96
100
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
101
|
+
if (!matched) {
|
|
102
|
+
window.location.href = `${origin}/search?q=${hash.slice(1)}¬-found=1`;
|
|
103
|
+
}
|
|
100
104
|
}
|
|
101
105
|
}
|
|
102
106
|
|
|
@@ -121,7 +125,7 @@ window.addEventListener('load', () => {
|
|
|
121
125
|
setTimeout(() => scrollSidebarItemIntoView(), 1000);
|
|
122
126
|
|
|
123
127
|
// docusaurus-openapi-docs plugin: scroll sidebar into viewport, no need for a large timeout here
|
|
124
|
-
setTimeout(() => scrollOpenApiSidebarItemIntoView(),
|
|
128
|
+
setTimeout(() => scrollOpenApiSidebarItemIntoView(), 200);
|
|
125
129
|
});
|
|
126
130
|
|
|
127
131
|
window.addEventListener('popstate', () => {
|