How to use the searchkit.renderComponent function in searchkit

To help you get started, we’ve selected a few searchkit 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 searchkit / searchkit / packages / searchkit-e2e-tests / src / apps / playground / index.tsx View on Github external
renderCell(hit, column, idx){
    const { cellComponent } = this.props

    const key = ((typeof column) === "string") ? column : column.key
    var element;
    if (cellComponent){
      return renderComponent(cellComponent, {hit, columnKey: key, key, column, columnIdx: idx})
    } else {
      return {hit._source[key]}
    }
  }
github searchkit / searchkit / packages / searchkit-e2e-tests / src / apps / ui-app / MockRange.tsx View on Github external
render():React.ReactElement {
      const { title, containerComponent, rangeComponent } = this.props
    return renderComponent(containerComponent, { title }, 
        renderComponent(rangeComponent, this.state)
    )
  }
github assembl / assembl / assembl / static2 / js / app / components / search / SortingSelector.jsx View on Github external
render() {
    const { listComponent, filterPrefix } = this.props;
    let options = this.accessor.options.options;
    options = options.filter((sort) => {
      const keyPrefix = sort.key.split(':')[0];
      return keyPrefix === filterPrefix || keyPrefix === 'common';
    });
    const selected = [this.accessor.getSelectedOption().key];
    const disabled = !this.hasHits();

    return renderComponent(listComponent, {
      mod: this.props.mod,
      className: this.props.className,
      items: options,
      selectedItems: selected,
      setItems: this.setItems.bind(this),
      toggleItem: this.toggleItem.bind(this),
      disabled: disabled,
      urlBuilder: item => this.accessor.urlWithState(item.key),
      translate: this.translate
    });
  }
}
github GregoryPotdevin / searchkit-daterangefilter / src / DateRangeFilter.js View on Github external
renderRangeComponent(component) {
    const { min, max } = this.props
    const state = this.accessor.state.getValue()
    return (
      <div>
        <div style="{{padding:">
          {renderComponent(component, {
            min, max,
            minValue: Number(get(state, "min", min)),
            maxValue: Number(get(state, "max", max)),
            items: this.accessor.getBuckets(),
            onChange: this.sliderUpdate,
            onFinished: this.sliderUpdateAndSearch
          })}
        </div>
      </div>
    )
  }
}
github searchkit / searchkit / packages / searchkit-refinement-autosuggest / src / RefinementAutosuggest.tsx View on Github external
render() {
        let {
            containerComponent, autosuggestComponent,
            id, title, multi, itemComponent
        } = this.props
        let selectedValues = this.accessor.state.getValue()

        return renderComponent(containerComponent, {
            title,
            className: id ? `filter--${id}` : undefined
        }, (
                renderComponent(autosuggestComponent, {
                    multi,
                    loadOptions: this.search,
                    onSelect: this.select,
                    selectedValues,
                    itemComponent
                })
            ))
    }
}
github PAK90 / mtg-hunter / src / FacetFilter.js View on Github external
render() {
    const { listComponent, containerComponent, showCount, title, id } = this.props
    return renderComponent(containerComponent, {
      title,
      className: id ? `filter--${id}` : undefined,
      disabled: !this.hasOptions()
    }, [
      renderComponent(listComponent, {
        key:"listComponent",
        items: this.getItems(),
        itemComponent:this.props.itemComponent,
        selectedItems: this.getSelectedItems(),
        toggleItem: this.toggleFilter.bind(this),
        setItems: this.setFilters.bind(this),
        docCount: this.accessor.getDocCount(),
        showCount,
        translate:this.translate
      }),
      this.renderShowMore()
github CRUKorg / cruk-searchkit / src / components / display / results-list / CRUKSearchkitResultsList.jsx View on Github external
render() {
    let hits = this.getHits();
    let hasHits = hits.length > 0;

    if (this.props.blockSearch) return null;

    if (!this.isInitialLoading() && hasHits) {
      const {listComponent, mod, className, itemComponent, additionalFields} = this.props;

      return renderComponent(listComponent, {
        hits, mod, className, itemComponent, additionalFields
      });
    }

    return null;
  }
}
github searchkit / searchkit-examples / searchkit-starter-react16 / src / components / RefinementFilterSuggest / RefinementSuggest.jsx View on Github external
render(){    
        let { 
            containerComponent, autosuggestComponent, 
            id, title, multi
        } = this.props
        let selectedValues = this.accessor.state.getValue()

        return renderComponent(containerComponent, {
            title,
            className: id ? `filter--${id}` : undefined
        }, (
            renderComponent(autosuggestComponent, {
                multi,
                loadOptions:this.search,
                onSelect:this.select,
                selectedValues
            })         
        ))
    }
}
github PAK90 / mtg-hunter / src / FacetFilter.js View on Github external
render() {
    const { listComponent, containerComponent, showCount, title, id } = this.props
    return renderComponent(containerComponent, {
      title,
      className: id ? `filter--${id}` : undefined,
      disabled: !this.hasOptions()
    }, [
      renderComponent(listComponent, {
        key:"listComponent",
        items: this.getItems(),
        itemComponent:this.props.itemComponent,
        selectedItems: this.getSelectedItems(),
        toggleItem: this.toggleFilter.bind(this),
        setItems: this.setFilters.bind(this),
        docCount: this.accessor.getDocCount(),
        showCount,
        translate:this.translate
      }),
      this.renderShowMore()
    ]);
  }