Skip to content

Commit

Permalink
Updated decoupled menu and algolia search components
Browse files Browse the repository at this point in the history
  • Loading branch information
pookmish committed Aug 15, 2024
1 parent c1b53e3 commit 869e33c
Show file tree
Hide file tree
Showing 10 changed files with 2,765 additions and 1,871 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/*! algoliasearch-lite.umd.js | 4.22.1 | © Algolia, inc. | https://github.com/algolia/algoliasearch-client-javascript */

/**
* @license React
* use-sync-external-store-shim.production.min.js
Expand Down
24 changes: 12 additions & 12 deletions themes/stanford_basic/algolia-search/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,26 @@
"dev": "webpack serve --env dev"
},
"dependencies": {
"algoliasearch": "^4.22.1",
"algoliasearch": "^5.0.0",
"preact": "^10.19.6",
"react-instantsearch": "^7.7.0",
"styled-components": "^6.1.8"
"react-instantsearch": "^7.12.4",
"styled-components": "^6.1.12"
},
"devDependencies": {
"@babel/core": "^7.24.0",
"@babel/preset-env": "^7.24.0",
"@babel/preset-react": "^7.23.3",
"@babel/preset-typescript": "^7.23.3",
"@babel/core": "^7.25.2",
"@babel/preset-env": "^7.25.3",
"@babel/preset-react": "^7.24.7",
"@babel/preset-typescript": "^7.24.7",
"@types/webpack": "^5.28.5",
"babel-loader": "^9.1.3",
"css-loader": "^6.10.0",
"dotenv-webpack": "^8.0.1",
"css-loader": "^7.1.2",
"dotenv-webpack": "^8.1.0",
"html-webpack-plugin": "^5.6.0",
"preact-island": "^1.1.2",
"terser-webpack-plugin": "^5.3.10",
"webpack": "^5.90.3",
"webpack": "^5.93.0",
"webpack-cli": "^5.1.4",
"webpack-dev-server": "^4.15.1"
"webpack-dev-server": "^5.0.4"
},
"packageManager": "yarn@4.1.1"
"packageManager": "yarn@4.4.0"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import algoliasearch from 'algoliasearch/lite';
import {liteClient} from 'algoliasearch/lite';
import {createIslandWebComponent} from 'preact-island'
import {HitsProps, InstantSearch, useHits} from 'react-instantsearch';
import SearchBox from "./search-box";
Expand All @@ -10,12 +10,13 @@ import {StanfordHit} from "./hits/hit.types";

const islandName = 'algolia-search'

/* global window */
const appId = window.drupalSettings?.stanfordAlgolia.appId || process.env.ALGOLIA_APP_ID
const key = window.drupalSettings?.stanfordAlgolia.searchKey || process.env.ALGOLIA_KEY

const searchClient = algoliasearch(appId, key);
const searchClient = liteClient(appId, key);

const Hit = ({hit}: HitsProps<StanfordHit>) => {
const Hit = ({hit}: HitsProps< StanfordHit>) => {
if (hit.type === 'Event') return <EventHit hit={hit}/>
if (hit.type === 'News') return <NewsHit hit={hit}/>

Expand All @@ -34,7 +35,7 @@ const Container = styled.div`
`

const CustomHits = (props) => {
const {hits} = useHits(props);
const {items: hits} = useHits(props);
if (hits.length === 0) return (
<p>No results for your search. Please try another search.</p>
)
Expand Down
Loading

0 comments on commit 869e33c

Please sign in to comment.