How to use the react-instantsearch/connectors.connectAutoComplete function in react-instantsearch

To help you get started, we’ve selected a few react-instantsearch examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github LessWrong2 / Lesswrong2 / packages / lesswrong / components / search / SearchAutoComplete.jsx View on Github external
event.stopPropagation();
    clickAction(suggestion._id)
  }
  return 
    <div>
      
      
    </div>
  
}

const AutocompleteTextbox = connectAutoComplete(
  ({
    // From connectAutoComplete HoC
    hits, currentRefinement, refine,
    // FromSearchAutoComplete
    onSuggestionSelected, placeholder, renderSuggestion, renderInputComponent
  }) =&gt; {
    return (
       refine(value)}
        onSuggestionsClearRequested={() =&gt; refine('')}
        getSuggestionValue={hit =&gt; hit.title}
        renderInputComponent={renderInputComponent}
        renderSuggestion={renderSuggestion}
        inputProps={{
github codesandbox / codesandbox-client / packages / app / src / app / pages / Sandbox / Editor / Workspace / Dependencies / SearchDependencies.js View on Github external
hit,
                  // Downshift supplies onClick
                  onVersionChange(version) {
                    onHitVersionChange(hit, version);
                  },
                })}
              /&gt;
            ))}
          
        
      )}
    
  );
}

const ConnectedAutoComplete = connectAutoComplete(RawAutoComplete);

type Props = {
  onConfirm: (dependency: string, version: string) =&gt; Promise,
};

export default class SearchDependencies extends React.PureComponent {
  props: Props;
  hitToVersionMap = new Map();

  handleSelect = hit =&gt; {
    let version = this.hitToVersionMap.get(hit);

    if (!version &amp;&amp; hit.tags) {
      version = hit.tags.latest;
    }
github LessWrong2 / Lesswrong2 / packages / lesswrong / components / search / SequencesSearchAutoComplete.jsx View on Github external
const algoliaAppId = getSetting('algolia.appId')
  const algoliaSearchKey = getSetting('algolia.searchKey')
  return 
    <div>
      
      
    </div>
  
}


const AutoComplete = connectAutoComplete(
  ({ hits, currentRefinement, refine, clickAction }) =&gt;
     refine(value)}
      onSuggestionsClearRequested={() =&gt; refine('')}
      getSuggestionValue={hit =&gt; hit.title}
      renderSuggestion={hit =&gt;
        }
      inputProps={{
        placeholder: 'Search for sequences',
        value: currentRefinement,
        onChange: () =&gt; {},
      }}
      highlightFirstSuggestion
    /&gt;
);
github codesandbox / codesandbox-client / packages / app / src / app / pages / Sandbox / SearchDependencies / index.js View on Github external
import React from 'react';
import { InstantSearch, Configure, PoweredBy } from 'react-instantsearch/dom';
import { connectAutoComplete } from 'react-instantsearch/connectors';

import Style from 'app/pages/Search/search';
import DependenciesCSS from './dependencies';

import RawAutoComplete from './RawAutoComplete';

const ConnectedAutoComplete = connectAutoComplete(RawAutoComplete);

export default class SearchDependencies extends React.PureComponent {
  hitToVersionMap = new Map();

  handleSelect = hit => {
    let version = this.hitToVersionMap.get(hit);

    if (!version && hit.tags) {
      version = hit.tags.latest;
    }

    this.props.onConfirm(hit.name, version);
  };

  handleManualSelect = hitName => {
    if (!hitName) {
github drex44 / good-food-guide / www / components / navigation / Search.js View on Github external
return (
      
    );
  }
}

const ConnectedSearchBox = connectAutoComplete(SearchBox2);

const RenderHit = ({ hit }) =&gt; (
  
    <button>
      
    </button>
  
);

RenderHit.propTypes = {
  hit: PropTypes.object.isRequired
github downshift-js / downshift / stories / examples / react-instantsearch.js View on Github external
fontWeight: selectedItem === item ? 'bold' : 'normal',
                    },
                  })}
                &gt;
                  
                
              ))}
            
          )}
        
      )}
    
  )
}

const AutoCompleteWithData = connectAutoComplete(RawAutoComplete)

function Examples() {
  return (
    
      Algolia{' '}
      <a href="https://community.algolia.com/react-instantsearch/">
        React InstantSearch
      </a>{' '}
      example
      
    
  )
github LessWrong2 / Lesswrong2 / packages / lesswrong / components / search / PostsSearchAutoComplete.jsx View on Github external
const algoliaAppId = getSetting('algolia.appId')
  const algoliaSearchKey = getSetting('algolia.searchKey')
  return 
    <div>
      
      
    </div>
  
}


const AutoComplete = connectAutoComplete(
  ({ hits, currentRefinement, refine, clickAction}) =&gt;
  {
    const onSuggestionSelected = (event, { suggestion }) =&gt; {
      event.preventDefault();
      event.stopPropagation();
      clickAction(suggestion._id)
    }
    return (
       refine(value)}
        onSuggestionsClearRequested={() =&gt; refine('')}
        getSuggestionValue={hit =&gt; hit.title}
        renderSuggestion={hit =&gt;
          }