How to use the algoliasearch-helper/src/algoliasearch.helper function in algoliasearch-helper

To help you get started, we’ve selected a few algoliasearch-helper 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 algolia / algolia-ui-kit / src / components / SearchBox / index.js View on Github external
"use strict";
var React = require( "react" );
var bem = require( "../BemHelper" )( "algolia-magic-search-box" );
var cx = require( "classnames" );

var AlgoliasearchHelper = require( "algoliasearch-helper/src/algoliasearch.helper" );
var SearchResults = require( "algoliasearch-helper/src/SearchResults" );

var SearchBox = React.createClass( {
  propTypes : {
    helper : React.PropTypes.instanceOf( AlgoliasearchHelper ),
    results : React.PropTypes.instanceOf( SearchResults ),
    onFocus : React.PropTypes.func,
    placeholder : React.PropTypes.string
  },
  render : function() {
    var onFocus = this.props.onFocus;
    var classNames = cx( bem( "input" ), this.props.inputClass );

    return
github algolia / algolia-ui-kit / src / components / HitsSelector / index.js View on Github external
var React = require( "react" );
var DDButton = require( "react-dropdown-button" )

var AlgoliasearchHelper = require( "algoliasearch-helper/src/algoliasearch.helper" );
var SearchResults = require( "algoliasearch-helper/src/SearchResults" );
var SearchParameters = require( "algoliasearch-helper/src/SearchParameters" );

var map = require( "lodash/collection/map" );
var without = require( "lodash/array/without" );

var HitsSelector = React.createClass( {
  propTypes : {
    helper : React.PropTypes.instanceOf( AlgoliasearchHelper ),
    results : React.PropTypes.instanceOf( SearchResults ),
    searchState : React.PropTypes.instanceOf( SearchParameters ),
    displayOptions : React.PropTypes.arrayOf( React.PropTypes.number )
  },
  render : function() {
    var selectedOption = parseInt( this.props.searchState.hitsPerPage, 10 );
    var selectableOptions = map(
      without( this.props.displayOptions, selectedOption ).sort( function(a, b){
        if( a > b ) return 1;
        return a < b ? -1 : 0;
      } ),
      function toDisplayObject( opt ) {
        return { label : opt, value : opt };
      }
    );
    return