instantsearch-app
python_robyn
Install
bash
npm install @wangzeyu/instantsearch-widget-instantsearch-app
# or
yarn add @wangzeyu/instantsearch-widget-instantsearch-appWidget
Usage
js
import instantsearch from 'instantsearch.js';
import algoliasearch from 'algoliasearch/lite';
import { instantsearchApp } from '@wangzeyu/instantsearch-widget-instantsearch-app';
const searchClient = algoliasearch('appId', 'apiKey');
const search = instantsearch({
indexName: 'indexName',
searchClient,
});
search.addWidgets([
instantsearchApp({
// widget parameters
}),
]);
search.start();Options
| Option | Type | Required | Default | Description |
|---|---|---|---|---|
container | string or HTMLElement | true | - | The element to insert the widget into. |
option1 | ... | true | - | REPLACE WITH THE DESCRIPTION FOR THIS OPTION |
container
string | Element| required
The element to insert the widget into.
This can be either a valid CSS Selector:
js
instantsearchApp({
container: '#instantsearch-app',
// ...
});or an HTMLElement:
js
instantsearchApp({
container: document.querySelector('#instantsearch-app'),
// ...
});option1
...| required
REPLACE WITH THE DESCRIPTION FOR THIS OPTION
js
instantsearchApp({
option1: 'value',
// ...
});Connector
Usage
js
import { connectInstantsearchApp } from '@wangzeyu/instantsearch-widget-instantsearch-app';
// 1. Create a render function
const renderInstantsearchApp = (renderOptions, isFirstRender) => {
// Rendering logic
};
// 2. Create the custom widget
const customInstantsearchApp = connectInstantsearchApp(
renderInstantsearchApp
);
// 3. Instantiate
search.addWidgets([
customInstantsearchApp({
// instance params
}),
]);Options
option1
...
REPLACE WITH THE DESCRIPTION FOR THIS RENDERING ITEM
js
const renderInstantsearchApp = (renderOptions, isFirstRender) => {
// show how to use this render option
};
const customInstantsearchApp = connectInstantsearchApp(
renderInstantsearchApp,
);
search.addWidgets([
customInstantsearchApp({
// ...
}),
]);widgetParams
object
All original widget options forwarded to the render function.
js
const renderInstantsearchApp = (renderOptions, isFirstRender) => {
const { widgetParams } = renderOptions;
widgetParams.container.innerHTML = '...';
};
const customInstantsearchApp = connectInstantsearchApp(
renderInstantsearchApp,
);
search.addWidgets([
customInstantsearchApp({
container: document.querySelector('#instantsearch-app'),
// ...
}),
]);Contributing
To start contributing to code, you need to:
- Fork the project
- Clone the repository
- Install the dependencies:
yarn - Run the development mode:
yarn start
Please read our contribution process to learn more.
This project was generated with create-instantsearch-app by Algolia.