Skip to content

Commit

Permalink
Use default PoweredBy Algolia component
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinashworth committed Dec 28, 2020
1 parent e984b3b commit d1e017d
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions packages/octave/lib/components/common/Search.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import Dropdown from 'react-bootstrap/Dropdown'
import FormControl from 'react-bootstrap/FormControl'
import InputGroup from 'react-bootstrap/InputGroup'
import algoliasearch from 'algoliasearch/lite'
import { Configure, connectHits, connectPoweredBy, connectSearchBox, connectStateResults, Highlight, InstantSearch, Snippet } from 'react-instantsearch-dom'
import { Configure, connectHits, connectSearchBox, connectStateResults, Highlight, InstantSearch, PoweredBy, Snippet } from 'react-instantsearch-dom'

// eslint-disable-next-line react/display-name
const CustomToggle = forwardRef(({ children }, ref) => (
Expand All @@ -30,17 +30,13 @@ const searchonlyapikey = Meteor.settings.public.algolia.SearchOnlyAPIKey
const algoliaindex = Meteor.settings.public.algolia.AlgoliaIndex
const searchClient = algoliasearch(applicationid, searchonlyapikey)

const PoweredBy = ({ url }) => <a href={url} target='_blank' rel='noopener noreferrer'>Algolia</a>

const CustomPoweredBy = connectPoweredBy(PoweredBy)

const Hits = ({ hits }) => {
const history = useHistory()
return (
<>
<Dropdown.Toggle as={CustomToggle} id='algolia-dropdown' />
<Dropdown.Menu popperConfig={popperConfig}>
<Dropdown.Header>Search powered by <CustomPoweredBy /></Dropdown.Header>
<Dropdown.Header className='text-right'><PoweredBy /></Dropdown.Header>
{hits.length === 0
? <Dropdown.Item disabled>No search results</Dropdown.Item>
: hits.map((hit) => {
Expand Down

0 comments on commit d1e017d

Please sign in to comment.