@docusaurus/theme-search-algolia 2.0.0-beta.1ab8aa0af → 2.0.0-beta.2

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": "@docusaurus/theme-search-algolia",
3
- "version": "2.0.0-beta.1ab8aa0af",
3
+ "version": "2.0.0-beta.2",
4
4
  "description": "Algolia search component for Docusaurus.",
5
5
  "main": "src/index.js",
6
6
  "publishConfig": {
@@ -13,11 +13,11 @@
13
13
  },
14
14
  "license": "MIT",
15
15
  "dependencies": {
16
- "@docsearch/react": "^3.0.0-alpha.33",
17
- "@docusaurus/core": "2.0.0-beta.1ab8aa0af",
18
- "@docusaurus/theme-common": "2.0.0-beta.1ab8aa0af",
19
- "@docusaurus/utils": "2.0.0-beta.1ab8aa0af",
20
- "@docusaurus/utils-validation": "2.0.0-beta.1ab8aa0af",
16
+ "@docsearch/react": "^3.0.0-alpha.36",
17
+ "@docusaurus/core": "2.0.0-beta.2",
18
+ "@docusaurus/theme-common": "2.0.0-beta.2",
19
+ "@docusaurus/utils": "2.0.0-beta.2",
20
+ "@docusaurus/utils-validation": "2.0.0-beta.2",
21
21
  "algoliasearch": "^4.8.4",
22
22
  "algoliasearch-helper": "^3.3.4",
23
23
  "clsx": "^1.1.1",
@@ -31,5 +31,5 @@
31
31
  "engines": {
32
32
  "node": ">=12.13.0"
33
33
  },
34
- "gitHead": "63c06baac39707a1a4c3cc4c0031cb2163f256c4"
34
+ "gitHead": "883f07fddffaf1657407c8e202e370cc436e25f7"
35
35
  }
@@ -16,6 +16,7 @@ import useSearchQuery from '@theme/hooks/useSearchQuery';
16
16
  import {DocSearchButton, useDocSearchKeyboardEvents} from '@docsearch/react';
17
17
  import useAlgoliaContextualFacetFilters from '@theme/hooks/useAlgoliaContextualFacetFilters';
18
18
  import {translate} from '@docusaurus/Translate';
19
+ import styles from './styles.module.css';
19
20
 
20
21
  let DocSearchModal = null;
21
22
 
@@ -164,17 +165,19 @@ function DocSearch({contextualSearch, ...props}) {
164
165
  />
165
166
  </Head>
166
167
 
167
- <DocSearchButton
168
- onTouchStart={importDocSearchModalIfNeeded}
169
- onFocus={importDocSearchModalIfNeeded}
170
- onMouseOver={importDocSearchModalIfNeeded}
171
- onClick={onOpen}
172
- ref={searchButtonRef}
173
- translations={{
174
- buttonText: translatedSearchLabel,
175
- buttonAriaLabel: translatedSearchLabel,
176
- }}
177
- />
168
+ <div className={styles.searchBox}>
169
+ <DocSearchButton
170
+ onTouchStart={importDocSearchModalIfNeeded}
171
+ onFocus={importDocSearchModalIfNeeded}
172
+ onMouseOver={importDocSearchModalIfNeeded}
173
+ onClick={onOpen}
174
+ ref={searchButtonRef}
175
+ translations={{
176
+ buttonText: translatedSearchLabel,
177
+ buttonAriaLabel: translatedSearchLabel,
178
+ }}
179
+ />
180
+ </div>
178
181
 
179
182
  {isOpen &&
180
183
  createPortal(
@@ -11,6 +11,7 @@
11
11
  }
12
12
 
13
13
  .DocSearch-Button {
14
+ margin: 0;
14
15
  transition: all var(--ifm-transition-fast)
15
16
  var(--ifm-transition-timing-default);
16
17
  }
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Copyright (c) Facebook, Inc. and its affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ @media (max-width: 996px) {
9
+ .searchBox {
10
+ position: absolute;
11
+ right: var(--ifm-navbar-padding-horizontal);
12
+ }
13
+ }
14
+
15
+ @media (min-width: 997px) {
16
+ .searchBox {
17
+ padding: var(--ifm-navbar-item-padding-vertical)
18
+ var(--ifm-navbar-item-padding-horizontal);
19
+ }
20
+ }
@@ -375,16 +375,19 @@ function SearchPage() {
375
375
  )}
376
376
  </form>
377
377
 
378
- <div className={clsx('row', 'margin-vert--sm')}>
378
+ <div className="row">
379
379
  <div className={clsx('col', 'col--8', styles.searchResultsColumn)}>
380
- {!!searchResultState.totalResults && (
381
- <strong>
382
- {documentsFoundPlural(searchResultState.totalResults)}
383
- </strong>
384
- )}
380
+ {!!searchResultState.totalResults &&
381
+ documentsFoundPlural(searchResultState.totalResults)}
385
382
  </div>
386
383
 
387
- <div className={clsx('col', 'col--4', styles.searchLogoColumn)}>
384
+ <div
385
+ className={clsx(
386
+ 'col',
387
+ 'col--4',
388
+ 'text--right',
389
+ styles.searchLogoColumn,
390
+ )}>
388
391
  <a
389
392
  target="_blank"
390
393
  rel="noopener noreferrer"
@@ -394,10 +397,7 @@ function SearchPage() {
394
397
  message: 'Search by Algolia',
395
398
  description: 'The ARIA label for Algolia mention',
396
399
  })}>
397
- <svg
398
- viewBox="0 0 168 24"
399
- className={styles.algoliaLogo}
400
- xmlns="http://www.w3.org/2000/svg">
400
+ <svg viewBox="0 0 168 24" className={styles.algoliaLogo}>
401
401
  <g fill="none">
402
402
  <path
403
403
  className={styles.algoliaLogoPathFill}
@@ -418,34 +418,32 @@ function SearchPage() {
418
418
  </div>
419
419
 
420
420
  {searchResultState.items.length > 0 ? (
421
- <section>
421
+ <main>
422
422
  {searchResultState.items.map(
423
423
  ({title, url, summary, breadcrumbs}, i) => (
424
424
  <article key={i} className={styles.searchResultItem}>
425
- <Link
426
- to={url}
427
- className={styles.searchResultItemHeading}
428
- dangerouslySetInnerHTML={{__html: title}}
429
- />
425
+ <h2 className={styles.searchResultItemHeading}>
426
+ <Link to={url} dangerouslySetInnerHTML={{__html: title}} />
427
+ </h2>
430
428
 
431
429
  {breadcrumbs.length > 0 && (
432
- <span className={styles.searchResultItemPath}>
433
- {breadcrumbs.map((html, index) => (
434
- <React.Fragment key={index}>
435
- {index !== 0 && (
436
- <span
437
- className={styles.searchResultItemPathSeparator}>
438
-
439
- </span>
440
- )}
441
- <span
430
+ <nav aria-label="breadcrumbs">
431
+ <ul
432
+ className={clsx(
433
+ 'breadcrumbs',
434
+ styles.searchResultItemPath,
435
+ )}>
436
+ {breadcrumbs.map((html, index) => (
437
+ <li
438
+ key={index}
439
+ className="breadcrumbs__item"
442
440
  // Developer provided the HTML, so assume it's safe.
443
441
  // eslint-disable-next-line react/no-danger
444
442
  dangerouslySetInnerHTML={{__html: html}}
445
443
  />
446
- </React.Fragment>
447
- ))}
448
- </span>
444
+ ))}
445
+ </ul>
446
+ </nav>
449
447
  )}
450
448
 
451
449
  {summary && (
@@ -459,7 +457,7 @@ function SearchPage() {
459
457
  </article>
460
458
  ),
461
459
  )}
462
- </section>
460
+ </main>
463
461
  ) : (
464
462
  [
465
463
  searchQuery && !searchResultState.loading && (
@@ -479,13 +477,11 @@ function SearchPage() {
479
477
 
480
478
  {searchResultState.hasMore && (
481
479
  <div className={styles.loader} ref={setLoaderRef}>
482
- <span>
483
- <Translate
484
- id="theme.SearchPage.fetchingNewResults"
485
- description="The paragraph for fetching new search results">
486
- Fetching new results...
487
- </Translate>
488
- </span>
480
+ <Translate
481
+ id="theme.SearchPage.fetchingNewResults"
482
+ description="The paragraph for fetching new search results">
483
+ Fetching new results...
484
+ </Translate>
489
485
  </div>
490
486
  )}
491
487
  </div>
@@ -8,23 +8,20 @@
8
8
  .searchQueryInput,
9
9
  .searchVersionInput {
10
10
  border-radius: var(--ifm-global-radius);
11
- border: 0;
12
- font-size: var(--ifm-font-size-base);
13
- font-family: var(--ifm-font-family-base);
11
+ border: 2px solid var(--ifm-toc-border-color);
12
+ font: var(--ifm-font-size-base) var(--ifm-font-family-base);
14
13
  padding: 0.8rem;
15
14
  width: 100%;
16
15
  background: var(--docsearch-searchbox-focus-background);
17
16
  color: var(--docsearch-text-color);
18
- margin-bottom: 1rem;
19
- box-shadow: inset 0 0 0 2px var(--ifm-toc-border-color);
20
- transition: var(--ifm-transition-fast) ease box-shadow;
17
+ margin-bottom: 0.5rem;
18
+ transition: border var(--ifm-transition-fast) ease;
21
19
  }
22
20
 
23
- .searchQueryInput:active,
24
21
  .searchQueryInput:focus,
25
- .searchVersionInput:active,
26
22
  .searchVersionInput:focus {
27
- box-shadow: var(--docsearch-searchbox-shadow);
23
+ border-color: var(--docsearch-primary-color);
24
+ outline: none;
28
25
  }
29
26
 
30
27
  .searchQueryInput::placeholder {
@@ -33,10 +30,7 @@
33
30
 
34
31
  .searchResultsColumn {
35
32
  font-size: 0.9rem;
36
- }
37
-
38
- .searchLogoColumn {
39
- text-align: right;
33
+ font-weight: bold;
40
34
  }
41
35
 
42
36
  .algoliaLogo {
@@ -53,20 +47,14 @@
53
47
  }
54
48
 
55
49
  .searchResultItemHeading {
56
- font-size: var(--ifm-h2-font-size);
50
+ font-weight: 400;
51
+ margin-bottom: 0;
57
52
  }
58
53
 
59
54
  .searchResultItemPath {
60
55
  font-size: 0.8rem;
61
56
  color: var(--ifm-color-content-secondary);
62
- display: block;
63
- }
64
-
65
- .searchResultItemPathSeparator {
66
- margin: 0 0.5rem;
67
- font-size: 1rem;
68
- font-weight: 600;
69
- color: var(--ifm-color-emphasis-400);
57
+ --ifm-breadcrumb-separator-size-multiplier: 1;
70
58
  }
71
59
 
72
60
  .searchResultItemSummary {
@@ -83,16 +71,11 @@
83
71
  max-width: 40% !important;
84
72
  }
85
73
 
86
- .algoliaLogo {
87
- width: 100%;
88
- }
89
-
90
74
  .searchResultsColumn {
91
75
  max-width: 60% !important;
92
76
  }
93
77
 
94
78
  .searchLogoColumn {
95
- overflow: hidden;
96
79
  max-width: 40% !important;
97
80
  padding-left: 0 !important;
98
81
  }
@@ -110,11 +93,9 @@
110
93
  }
111
94
 
112
95
  .loadingSpinner {
113
- pointer-events: none;
114
96
  width: 3rem;
115
97
  height: 3rem;
116
- border: 0.4em solid transparent;
117
- border-color: #eee;
98
+ border: 0.4em solid #eee;
118
99
  border-top-color: var(--ifm-color-primary);
119
100
  border-radius: 50%;
120
101
  animation: loadingspin 1s linear infinite;