hds-web 1.36.6 → 1.36.7

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": "hds-web",
3
- "version": "1.36.6",
3
+ "version": "1.36.7",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.es.js",
@@ -1,6 +1,5 @@
1
1
  export const INDEX_TYPES = Object.freeze({
2
2
  All: "All",
3
- events: "events",
4
3
  //Website: "website",
5
4
  blog: "blog",
6
5
  docs: "docs",
@@ -12,112 +11,35 @@ export const INDEX_TYPES = Object.freeze({
12
11
  });
13
12
 
14
13
  export const SEARCH_INDICES = [
15
- {
16
- name: `marketing_events`,
17
- title: `Hasura Events`,
18
- type: INDEX_TYPES.events,
19
- },
20
14
  { name: `blog-production`, title: `Hasura Blog`, type: INDEX_TYPES.blog },
21
- {
22
- name: `graphql-docs-prod`,
23
- title: `Hasura GraphQL Engine Docs`,
24
- type: INDEX_TYPES.docs,
25
- },
26
- {
27
- name: `learn-intro-graphql`,
28
- title: `Learn Intro GraphQL`,
29
- type: INDEX_TYPES.learn,
30
- },
31
- {
32
- name: `learn-intro-graphql-zh`,
33
- title: `Learn Intro GraphQL`,
34
- type: INDEX_TYPES.learn,
35
- },
36
- {
37
- name: `learn-elm-graphql`,
38
- title: `Learn ELM GraphQl`,
39
- type: INDEX_TYPES.learn,
40
- },
41
- {
42
- name: `learn-flutter-graphql`,
43
- title: `Learn Flutter GraphQL`,
44
- type: INDEX_TYPES.learn,
45
- },
46
- {
47
- name: `learn-database-mysql`,
48
- title: `Learn Database MySQL`,
49
- type: INDEX_TYPES.learn,
50
- },
15
+ { name: `graphql-docs-prod`, title: `Hasura GraphQL Engine Docs`, type: INDEX_TYPES.docs },
16
+ { name: `learn-intro-graphql`, title: `Learn Intro GraphQL`, type: INDEX_TYPES.learn },
17
+ { name: `learn-intro-graphql-zh`, title: `Learn Intro GraphQL`, type: INDEX_TYPES.learn },
18
+ { name: `learn-elm-graphql`, title: `Learn ELM GraphQl`, type: INDEX_TYPES.learn },
19
+ { name: `learn-flutter-graphql`, title: `Learn Flutter GraphQL`, type: INDEX_TYPES.learn },
20
+ { name: `learn-database-mysql`, title: `Learn Database MySQL`, type: INDEX_TYPES.learn },
51
21
  {
52
22
  name: `learn-database-postgresql`,
53
23
  title: `Learn Database PostgreSQL`,
54
24
  type: INDEX_TYPES.learn,
55
25
  },
56
- {
57
- name: `learn-hasura-backend`,
58
- title: `Learn Hasura Backend`,
59
- type: INDEX_TYPES.learn,
60
- },
61
- {
62
- name: `learn-hasura-backend-ja`,
63
- title: `Learn Hasura Backend`,
64
- type: INDEX_TYPES.learn,
65
- },
66
- {
67
- name: `learn-hasura-backend-zh`,
68
- title: `Learn Hasura Backend`,
69
- type: INDEX_TYPES.learn,
70
- },
71
- {
72
- name: `learn-hasura-backend-advanced`,
73
- title: `Learn Hasura Backend Advanced`,
74
- type: INDEX_TYPES.learn,
75
- },
76
- {
77
- name: `learn-hasura-auth-slack`,
78
- title: `Learn Hasura Auth Slack`,
79
- type: INDEX_TYPES.learn,
80
- },
81
- {
82
- name: `learn-react-apollo-hooks`,
83
- title: `Learn React Apollo Hooks`,
84
- type: INDEX_TYPES.learn,
85
- },
86
- {
87
- name: `learn-react-apollo`,
88
- title: `Learn React Apollo`,
89
- type: INDEX_TYPES.learn,
90
- },
26
+ { name: `learn-hasura-backend`, title: `Learn Hasura Backend`, type: INDEX_TYPES.learn },
27
+ { name: `learn-hasura-backend-ja`, title: `Learn Hasura Backend`, type: INDEX_TYPES.learn },
28
+ { name: `learn-hasura-backend-zh`, title: `Learn Hasura Backend`, type: INDEX_TYPES.learn },
29
+ { name: `learn-hasura-backend-advanced`, title: `Learn Hasura Backend Advanced`, type: INDEX_TYPES.learn },
30
+ { name: `learn-hasura-auth-slack`, title: `Learn Hasura Auth Slack`, type: INDEX_TYPES.learn },
31
+ { name: `learn-react-apollo-hooks`, title: `Learn React Apollo Hooks`, type: INDEX_TYPES.learn },
32
+ { name: `learn-react-apollo`, title: `Learn React Apollo`, type: INDEX_TYPES.learn },
91
33
  {
92
34
  name: `learn-typescript-react-apollo`,
93
35
  title: `Learn TypeScript React Apollo`,
94
36
  type: INDEX_TYPES.learn,
95
37
  },
96
- {
97
- name: `learn-angular-apollo`,
98
- title: `Learn Angular Apollo`,
99
- type: INDEX_TYPES.learn,
100
- },
101
- {
102
- name: `learn-vue-apollo`,
103
- title: `Learn Vue Apollo`,
104
- type: INDEX_TYPES.learn,
105
- },
106
- {
107
- name: `learn-ios-apollo`,
108
- title: `Learn IOS Apollo`,
109
- type: INDEX_TYPES.learn,
110
- },
111
- {
112
- name: `learn-svelte-apollo`,
113
- title: `Learn Svelte Apollo`,
114
- type: INDEX_TYPES.learn,
115
- },
116
- {
117
- name: `learn-android-apollo`,
118
- title: `Learn Android Apollo`,
119
- type: INDEX_TYPES.learn,
120
- },
38
+ { name: `learn-angular-apollo`, title: `Learn Angular Apollo`, type: INDEX_TYPES.learn },
39
+ { name: `learn-vue-apollo`, title: `Learn Vue Apollo`, type: INDEX_TYPES.learn },
40
+ { name: `learn-ios-apollo`, title: `Learn IOS Apollo`, type: INDEX_TYPES.learn },
41
+ { name: `learn-svelte-apollo`, title: `Learn Svelte Apollo`, type: INDEX_TYPES.learn },
42
+ { name: `learn-android-apollo`, title: `Learn Android Apollo`, type: INDEX_TYPES.learn },
121
43
  {
122
44
  name: `learn-react-native-apollo`,
123
45
  title: `Learn React Native Apollo`,
@@ -128,9 +50,5 @@ export const SEARCH_INDICES = [
128
50
  title: `Learn Reason React Apollo`,
129
51
  type: INDEX_TYPES.learn,
130
52
  },
131
- {
132
- name: `learn-database-mssql`,
133
- title: `Learn MicrosoftSQL`,
134
- type: INDEX_TYPES.learn,
135
- },
53
+ { name: `learn-database-mssql`, title: `Learn MicrosoftSQL`, type: INDEX_TYPES.learn },
136
54
  ];
@@ -4,7 +4,6 @@ import SearchOverlay from "./searchoverlay";
4
4
  import { Icon } from "../../components/common-components";
5
5
  export default function Search(props) {
6
6
  const [showSearch, setShowSearch] = useState(false);
7
- // const [showSearch, setShowSearch] = useState(true);
8
7
 
9
8
  const handleSearchWithKeyboard = (e) => {
10
9
  if (e.key === "/" || e.key === "Escape") {
@@ -9,17 +9,11 @@ const SearchFooter = () => (
9
9
  <p>Unable to find what you're looking for?</p>
10
10
  <p>
11
11
  Reach out to our{" "}
12
- <a
13
- className="text-blue-500 hover:text-blue-700"
14
- href="https://discord.com/invite/hasura"
15
- target="_blank"
16
- rel="noopener noreferrer"
17
- >
12
+ <a className="text-blue-500 hover:text-blue-700" href="https://discord.com/invite/hasura" target="_blank" rel="noopener noreferrer">
18
13
  Discord Community
19
14
  </a>{" "}
20
15
  or start a{" "}
21
- <a
22
- className="text-blue-500 hover:text-blue-700"
16
+ <a className="text-blue-500 hover:text-blue-700"
23
17
  href="https://github.com/hasura/graphql-engine/discussions"
24
18
  target="_blank"
25
19
  rel="noopener noreferrer"
@@ -1,9 +1,11 @@
1
- import React, { useEffect } from "react";
2
- import { Icon } from "../../components/common-components/Icon";
1
+ import React from "react";
2
+ import { useEffect, useState } from "react";
3
+ import { Icon } from '../../components/common-components/Icon'
3
4
  import SearchWrapper from "./searchwrapper";
4
5
  import { SEARCH_INDICES } from "./constants";
5
6
 
6
- export default function SearchOverlay({ showSearch, onCloseSearch, ...props }) {
7
+ export default function SearchOverlay({showSearch, onCloseSearch, ...props}) {
8
+
7
9
  useEffect(() => {
8
10
  if (showSearch) {
9
11
  document.body.style.overflow = "hidden";
@@ -18,15 +20,8 @@ export default function SearchOverlay({ showSearch, onCloseSearch, ...props }) {
18
20
 
19
21
  return (
20
22
  <div className="fixed left-0 top-0 w-full h-full z-[10000] bg-neutral-100">
21
- <div
22
- className="absolute top-4 right-4 cursor-pointer z-[11]"
23
- onClick={onCloseSearch}
24
- >
25
- <Icon
26
- height={"w-8 h-8 stroke-[1.5px]"}
27
- variant="xclose"
28
- strokeClass="stroke-neutral-800"
29
- />
23
+ <div className="absolute top-4 right-4 cursor-pointer z-[11]" onClick={onCloseSearch}>
24
+ <Icon height={'w-8 h-8 stroke-[1.5px]'} variant="xclose" strokeClass="stroke-neutral-800" />
30
25
  </div>
31
26
  <div className="py-20 overflow-y-auto h-full w-full bg-neutral-100">
32
27
  <div className="px-4">
@@ -39,4 +34,4 @@ export default function SearchOverlay({ showSearch, onCloseSearch, ...props }) {
39
34
  </div>
40
35
  </div>
41
36
  );
42
- }
37
+ }
@@ -1,64 +1,44 @@
1
1
  import React, { Fragment } from "react";
2
- import { connectStateResults, Hits, Index } from "react-instantsearch-dom";
2
+ import { connectStateResults, Highlight, Hits, Index, Snippet } from "react-instantsearch-dom";
3
3
  import { INDEX_TYPES } from "./constants";
4
4
  import SearchFooter from "./searchfooter";
5
- import { Typography } from "../../foundation/Typography";
6
- import { Icon } from "../../components/common-components/Icon";
7
- import { SearchHit } from "./SearchHit";
5
+ import { Typography } from '../../foundation/Typography'
6
+ import { Icon } from '../../components/common-components/Icon';
7
+
8
+ // import SearchFooter from "./SearchFooter";
9
+
10
+ const baseDomain = 'hasura.io';
11
+
8
12
 
9
13
  const HitsHeader = ({ searchResults, indexTitle, showSeparator, allIndex }) => {
10
14
  const hitCount = searchResults && searchResults.nbHits;
11
15
  const titleIcon = () => {
12
- if (indexTitle === "Hasura Blog") {
16
+ if(indexTitle === "Hasura Blog") {
13
17
  return (
14
- <Icon
15
- height={"block w-6 mr-3 h-6 stroke-[2px] transition ease-in-out"}
16
- variant="pentool02"
17
- strokeClass="stroke-blue-500"
18
- />
19
- );
18
+ <Icon height={'block w-6 mr-3 h-6 stroke-[2px] transition ease-in-out'} variant="pentool02" strokeClass='stroke-blue-500' />
19
+ )
20
20
  }
21
- if (indexTitle === "Hasura GraphQL Engine Docs") {
21
+ if(indexTitle === "Hasura GraphQL Engine Docs") {
22
22
  return (
23
- <Icon
24
- height={"block w-6 mr-3 h-6 stroke-[2px] transition ease-in-out"}
25
- variant="file02"
26
- strokeClass="stroke-blue-500"
27
- />
28
- );
29
- }
30
-
31
- if (indexTitle === "Hasura Events") {
32
- return (
33
- <Icon
34
- height={"block w-6 mr-3 h-6 stroke-[2px] transition ease-in-out"}
35
- variant="calendarplus02"
36
- strokeClass="stroke-blue-500"
37
- />
38
- );
23
+ <Icon height={'block w-6 mr-3 h-6 stroke-[2px] transition ease-in-out'} variant="file02" strokeClass='stroke-blue-500' />
24
+ )
39
25
  }
40
-
41
26
  return (
42
- <Icon
43
- height={"block w-6 mr-3 h-6 stroke-[2px] transition ease-in-out"}
44
- variant="graduationhat01"
45
- strokeClass="stroke-blue-500"
46
- />
47
- );
48
- };
49
-
27
+ <Icon height={'block w-6 mr-3 h-6 stroke-[2px] transition ease-in-out'} variant="graduationhat01" strokeClass='stroke-blue-500' />
28
+ )
29
+ }
30
+
50
31
  return hitCount > 0 ? (
51
32
  <Fragment>
52
33
  {showSeparator && <hr className="my-8 border-t-neutral-200" />}
53
34
  {/* <div className="HitCount">
54
35
  {hitCount} result{hitCount !== 1 ? `s` : ``}
55
36
  </div> */}
56
- <Typography
57
- textStyle="sub1"
58
- className="pb-4 pl-2 flex items-center text-neutral-800 font-normal sticky tb-m:z-0 top-[170px] tb:top-[160px] tb-m:top-[120px] bg-neutral-100"
59
- >
60
- {titleIcon()}
61
-
37
+ <Typography textStyle="sub1" className="pb-4 pl-2 flex items-center text-neutral-800 font-normal sticky tb-m:z-0 top-[170px] tb:top-[160px] tb-m:top-[120px] bg-neutral-100">
38
+ {
39
+ titleIcon()
40
+ }
41
+
62
42
  {indexTitle}
63
43
  </Typography>
64
44
  </Fragment>
@@ -67,15 +47,60 @@ const HitsHeader = ({ searchResults, indexTitle, showSeparator, allIndex }) => {
67
47
 
68
48
  const CustomHitsHeader = connectStateResults(HitsHeader);
69
49
 
50
+ const PageHit = ({ hit, indexType }) => (
51
+ <a href={hit.url} className="grid h-full">
52
+ <div className="self-start">
53
+ {/* <Typography textStyle="body3c-medium" className="uppercase text-neutral-500">{indexType}</Typography> */}
54
+ {indexType === INDEX_TYPES.docs ? (
55
+ <div className="flex items-start">
56
+ <div className="w-6 h-6 mr-2 min-w-[24px] flex items-center justify-center">
57
+ <div className="w-3 h-3 rounded-full bg-blue-500"></div>
58
+ </div>
59
+ <div>
60
+ {!!hit.hierarchy && (
61
+ <Typography textStyle="body1c-bold" className="font-bold flex items-start pb-3">
62
+ {`${
63
+ Object.values(hit.hierarchy)
64
+ .filter(h => !!h)
65
+ .reverse()[0]
66
+ }`}</Typography>
67
+ )}
68
+ <Typography textStyle="body2" className="text-neutral-800 word-break">
69
+ <Snippet attribute="content" hit={hit} tagName="mark" />
70
+ </Typography>
71
+ </div>
72
+ </div>
73
+ ) : (
74
+ <div className="flex items-start">
75
+ <div className="w-6 h-6 mr-2 min-w-[24px] flex items-center justify-center">
76
+ <div className="w-3 h-3 rounded-full bg-blue-500"></div>
77
+ </div>
78
+ <div>
79
+ <Typography textStyle="body1c-bold" className="font-bold text-neutral-800 pb-3">
80
+ <Highlight attribute="title" hit={hit} tagName="mark" />
81
+ </Typography>
82
+ <Typography textStyle="body2" className="text-neutral-800 word-break">
83
+ <Snippet attribute="excerpt" hit={hit} tagName="mark" />
84
+ </Typography>
85
+ </div>
86
+ </div>
87
+ )}
88
+ </div>
89
+ {hit.url ? (
90
+ <Typography textStyle="body3" className="self-end pl-8 pt-3 text-neutral-500">
91
+ <span className='hit-slug word-break'>{hit.url.replace(`https://${baseDomain}/`, "/")}</span>
92
+ </Typography>
93
+ ) : null}
94
+ </a>
95
+ );
96
+
70
97
  const HitsByIndexType = ({ indexType }) => {
71
98
  if (INDEX_TYPES[indexType] === undefined) return null;
72
99
 
73
100
  return (
74
101
  <Hits
75
102
  className="Hits"
76
- hitComponent={(hitProps) => (
77
- <SearchHit {...hitProps} indexType={indexType} />
78
- )}
103
+ hitComponent={hitProps => <PageHit {...hitProps} indexType={indexType} />}
79
104
  />
80
105
  );
81
106
  };
@@ -86,8 +111,8 @@ const HitsInIndex = ({ index, show }) => (
86
111
  <Fragment>
87
112
  <CustomHitsHeader
88
113
  indexTitle={index.title}
89
- showSeparator={index.type !== INDEX_TYPES.events}
90
- allIndex={index.type}
114
+ showSeparator={index.type !== INDEX_TYPES.blog}
115
+ allIndex = {index.type}
91
116
  />
92
117
  <HitsByIndexType indexType={index.type} />
93
118
  </Fragment>
@@ -95,26 +120,11 @@ const HitsInIndex = ({ index, show }) => (
95
120
  </Index>
96
121
  );
97
122
 
98
- const SearchResult = ({
99
- children,
100
- indices,
101
- className,
102
- id,
103
- wrapperRef,
104
- activeIndexTypes,
105
- }) => (
106
- <div
107
- id={id}
108
- className={`${className} search-results clear-both`}
109
- ref={wrapperRef}
110
- >
123
+ const SearchResult = ({ children, indices, className, id, wrapperRef, activeIndexTypes }) => (
124
+ <div id={id} className={`${className} search-results clear-both`} ref={wrapperRef}>
111
125
  {children && children}
112
- {indices.map((index) => (
113
- <HitsInIndex
114
- index={index}
115
- key={index.name}
116
- show={activeIndexTypes[index.type]}
117
- />
126
+ {indices.map(index => (
127
+ <HitsInIndex index={index} key={index.name} show={activeIndexTypes[index.type]} />
118
128
  ))}
119
129
  <SearchFooter />
120
130
  </div>
@@ -1,28 +1,19 @@
1
1
  import algoliasearch from "algoliasearch/lite";
2
2
  import React, { useRef, useState, useEffect } from "react";
3
- import {
4
- InstantSearch,
5
- connectStateResults,
6
- Index,
7
- } from "react-instantsearch-dom";
3
+ import { InstantSearch, connectStateResults, Index } from "react-instantsearch-dom";
8
4
  import SearchBox from "./searchbox";
9
5
  import SearchResults from "./searchresults";
10
6
  import { INDEX_TYPES } from "./constants";
11
7
  import SearchFooter from "./searchfooter";
12
- import { Typography } from "../../foundation/Typography";
13
-
14
- const AllResults = ({
15
- allSearchResults,
16
- children,
17
- indices,
18
- searchState,
19
- searching,
20
- }) => {
8
+ import { Typography } from '../../foundation/Typography'
9
+
10
+
11
+
12
+ const AllResults = ({ allSearchResults, children, indices, searchState, searching }) => {
21
13
  if (!searchState?.query) return null;
22
14
 
23
15
  const hasResults =
24
- allSearchResults &&
25
- Object.values(allSearchResults).some((results) => results.nbHits > 0);
16
+ allSearchResults && Object.values(allSearchResults).some(results => results.nbHits > 0);
26
17
  return !hasResults ? (
27
18
  <div>
28
19
  <div>
@@ -36,7 +27,7 @@ const AllResults = ({
36
27
  </span>
37
28
  )}
38
29
  </div>
39
- {indices.map((index) => (
30
+ {indices.map(index => (
40
31
  <Index indexName={index.name} key={index.name} />
41
32
  ))}
42
33
  <SearchFooter />
@@ -54,74 +45,57 @@ const IndexTypeFilter = ({ activeIndexTypes, setActiveIndexTypes }) => {
54
45
  const handleOnClick = (indexType) => {
55
46
  if (indexType === INDEX_TYPES.All) {
56
47
  showAll = true;
57
- const allFiltersSelected = Object.keys(activeIndexTypes).reduce(
58
- (acc, key) => {
59
- acc[key] = true;
60
- return acc;
61
- },
62
- {}
63
- );
48
+ const allFiltersSelected = Object.keys(activeIndexTypes).reduce((acc, key) => {
49
+ acc[key] = true;
50
+ return acc;
51
+ }, {});
64
52
  setActiveIndexTypes(allFiltersSelected);
65
53
  } else {
66
- showAll = false;
67
- const allFiltersSelected = Object.keys(activeIndexTypes).reduce(
68
- (acc, key) => {
69
- acc[key] = false;
70
- return acc;
71
- },
72
- {}
73
- );
54
+ showAll = false
55
+ const allFiltersSelected = Object.keys(activeIndexTypes).reduce((acc, key) => {
56
+ acc[key] = false;
57
+ return acc;
58
+ }, {});
74
59
  setActiveIndexTypes(allFiltersSelected);
75
60
  setActiveIndexTypes((prevState) => ({
76
61
  ...prevState,
77
62
  [indexType]: !prevState[indexType],
78
63
  }));
79
64
  }
80
- setShowDropdown(false);
65
+ setShowDropdown(false)
81
66
  };
82
67
 
83
68
  return (
84
69
  <div className="relative">
85
- <div className="tb-m:min-w-[182px] static tb-m:sticky top-[116px] self-start">
86
- <ul className="hds-hidden tb-m:block bg-neutral-0 shadow-md p-4 rounded-2xl">
87
- {Object.values(INDEX_TYPES).map((index) => (
88
- <li
89
- key={index}
90
- className="flex items-center mb-2 last:mb-0 tb-m:mr-0 py-0"
70
+ <div className="tb-m:min-w-[182px] static tb-m:sticky top-[116px] self-start">
71
+ <ul className="hds-hidden tb-m:block bg-neutral-0 shadow-md p-4 rounded-2xl">
72
+ {Object.values(INDEX_TYPES).map((index) => (
73
+ <li key={index} className="flex items-center mb-2 last:mb-0 tb-m:mr-0 py-0">
74
+ <button
75
+ onClick={() => handleOnClick(index)}
76
+ className={`capitalize cursor-pointer py-1 px-3 w-full text-left rounded-full text-neutral-500 ${(activeIndexTypes[index] && index === 'All') ? "bg-blue-500 " : ""
77
+ } ${(activeIndexTypes[index] && !showAll) ? 'bg-blue-500': ''} `}
91
78
  >
92
- <button
93
- onClick={() => handleOnClick(index)}
94
- className={`capitalize cursor-pointer py-1 px-3 w-full text-left rounded-full text-neutral-500 ${
95
- activeIndexTypes[index] && index === "All"
96
- ? "bg-blue-500 "
97
- : ""
98
- } ${activeIndexTypes[index] && !showAll ? "bg-blue-500" : ""} `}
79
+ <Typography
80
+ textStyle="body3c-medium"
81
+ className={`${(activeIndexTypes[index] && index === 'All') ? "text-neutral-0 " : ""} ${(activeIndexTypes[index] && !showAll) ? 'text-neutral-0' : ''} `
82
+ }
99
83
  >
100
- <Typography
101
- textStyle="body3c-medium"
102
- className={`${
103
- activeIndexTypes[index] && index === "All"
104
- ? "text-neutral-0 "
105
- : ""
106
- } ${
107
- activeIndexTypes[index] && !showAll ? "text-neutral-0" : ""
108
- } `}
109
- >
110
- {index}
111
- </Typography>
112
- </button>
113
- </li>
114
- ))}
115
- </ul>
116
- </div>
84
+ {index}
85
+ </Typography>
86
+ </button>
87
+ </li>
88
+ ))}
89
+ </ul>
90
+
91
+ </div>
117
92
  <div className="relative hds-hidden-tbm">
118
93
  <button
119
94
  onClick={() => setShowDropdown(!showDropdown)}
120
95
  className="capitalize cursor-pointer py-1 px-3 w-full border border-neutral-800 text-left rounded-full text-neutral-800 bg-transparent"
121
96
  >
122
- {Object.values(INDEX_TYPES).find(
123
- (index) => activeIndexTypes[index]
124
- ) || "All"}
97
+ {Object.values(INDEX_TYPES).find((index) => activeIndexTypes[index]) || "All"}
98
+
125
99
  </button>
126
100
  {showDropdown && (
127
101
  <ul className="absolute top-full left-0 w-full bg-neutral-0 shadow-md z-[20] p-2 rounded-3xl mt-1">
@@ -129,11 +103,8 @@ const IndexTypeFilter = ({ activeIndexTypes, setActiveIndexTypes }) => {
129
103
  <li
130
104
  key={index}
131
105
  onClick={() => handleOnClick(index)}
132
- className={`capitalize cursor-pointer py-2 px-4 ${
133
- activeIndexTypes[index]
134
- ? "text-neutral-1000 "
135
- : "text-neutral-500"
136
- }`}
106
+ className={`capitalize cursor-pointer py-2 px-4 ${activeIndexTypes[index] ? "text-neutral-1000 " : "text-neutral-500"
107
+ }`}
137
108
  >
138
109
  {index}
139
110
  </li>
@@ -141,21 +112,21 @@ const IndexTypeFilter = ({ activeIndexTypes, setActiveIndexTypes }) => {
141
112
  </ul>
142
113
  )}
143
114
  </div>
115
+
144
116
  </div>
145
117
  );
146
118
  };
147
119
 
148
- let ALGOLIA_APP_ID = `WCBB1VVLRC`;
149
- let ALGOLIA_SEARCH_KEY = `baf43aa3921858bc144d0fe5ce85b526`;
150
-
151
120
  export default function SearchWrapper({ indices, ...props }) {
152
- // let ALGOLIA_APP_ID, ALGOLIA_SEARCH_KEY;
153
- // if (props.ALGOLIA_APP_ID && props.ALGOLIA_SEARCH_KEY) {
154
- // ALGOLIA_APP_ID = props.ALGOLIA_APP_ID;
155
- // ALGOLIA_SEARCH_KEY = props.ALGOLIA_SEARCH_KEY;
156
- // }
157
-
158
- const algoliaClient = algoliasearch(ALGOLIA_APP_ID, ALGOLIA_SEARCH_KEY);
121
+ let ALGOLIA_APP_ID, ALGOLIA_SEARCH_KEY ;
122
+ if (props.ALGOLIA_APP_ID && props.ALGOLIA_SEARCH_KEY){
123
+ ALGOLIA_APP_ID = props.ALGOLIA_APP_ID;
124
+ ALGOLIA_SEARCH_KEY = props.ALGOLIA_SEARCH_KEY;
125
+ }
126
+ const algoliaClient = algoliasearch(
127
+ ALGOLIA_APP_ID,
128
+ ALGOLIA_SEARCH_KEY
129
+ );
159
130
 
160
131
  const searchClient = {
161
132
  ...algoliaClient,
@@ -175,17 +146,13 @@ export default function SearchWrapper({ indices, ...props }) {
175
146
  },
176
147
  };
177
148
 
178
- const defaultIndexTypesState = Object.values(INDEX_TYPES).reduce(
179
- (acc, index) => {
180
- acc[index] = true;
181
- return acc;
182
- },
183
- {}
184
- );
149
+
150
+ const defaultIndexTypesState = Object.values(INDEX_TYPES).reduce((acc, index) => {
151
+ acc[index] = true;
152
+ return acc;
153
+ }, {});
185
154
  const wrapperRef = useRef(null);
186
- const [activeIndexTypes, setActiveIndexTypes] = useState(
187
- defaultIndexTypesState
188
- );
155
+ const [activeIndexTypes, setActiveIndexTypes] = useState(defaultIndexTypesState);
189
156
  useEffect(() => {
190
157
  setActiveIndexTypes(defaultIndexTypesState);
191
158
  }, []);
@@ -201,8 +168,8 @@ export default function SearchWrapper({ indices, ...props }) {
201
168
  <div className="tb-m:flex gap-10">
202
169
  <div className="hds-hidden tb-m:flex">
203
170
  <IndexTypeFilter
204
- activeIndexTypes={activeIndexTypes}
205
- setActiveIndexTypes={setActiveIndexTypes}
171
+ activeIndexTypes={activeIndexTypes}
172
+ setActiveIndexTypes={setActiveIndexTypes}
206
173
  />
207
174
  </div>
208
175
  <SearchResults
@@ -210,14 +177,13 @@ export default function SearchWrapper({ indices, ...props }) {
210
177
  indices={indices}
211
178
  wrapperRef={wrapperRef}
212
179
  activeIndexTypes={activeIndexTypes}
213
- className="search-results"
214
- >
215
- <div className="hds-hidden-tbm sticky top-[124px] tb:top-[114px] z-10 bg-neutral-100 pb-3">
216
- <IndexTypeFilter
217
- activeIndexTypes={activeIndexTypes}
218
- setActiveIndexTypes={setActiveIndexTypes}
219
- />
220
- </div>
180
+ className="search-results">
181
+ <div className="hds-hidden-tbm sticky top-[124px] tb:top-[114px] z-10 bg-neutral-100 pb-3">
182
+ <IndexTypeFilter
183
+ activeIndexTypes={activeIndexTypes}
184
+ setActiveIndexTypes={setActiveIndexTypes}
185
+ />
186
+ </div>
221
187
  </SearchResults>
222
188
  </div>
223
189
  </CustomAllResults>