Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"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
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