0.2.6 ā€¢ Published 5 years ago

instantsearch-color-refinement-list-react v0.2.6

Weekly downloads
43
License
-
Repository
github
Last release
5 years ago

ColorRefinementList Widget

šŸŽ„ See it Live on CodeSandbox

Demo

Demo of ColorRefinementList Widget

Description

This is the ColorRefinementList Labs widget for React InstantSearch. You can use this widget to refine results by color tags with Algolia.

This widget displays the colors of the formated facet. The facet value should have a title and hex code separated by a ';' (Eg. black;#000)

This helps the user quickly visualise the kind of color that you have in your index. This is a great widget to refine records within multiple shades of a single color (like choosing the color of a jean).

Table of Contents

Get the code

This widget comes with JavaScript but also pre-defined CSS.

JavaScript

You can copy and paste the JavaScript code from the repository itself, grab it in the src/lib folder and use the <ColorRefinementList /> component.

CSS

You can copy and paste the necessary CSS code from the repository itself, grab it in src/lib/ColorRefinementList.css.

Usage

Install it with yarn add instantsearch-color-refinement-list-react then, use it as simply as:

import { InstantSearch, Panel } from 'react-instantsearch-dom';
import ColorRefinementList from 'instantsearch-color-refinement-list-react';

<InstantSearch
    appId="..."
    apiKey="..."
    indexName="..."
>
    <Panel header="...">
        <ColorRefinementList
            attribute="..."
        />
    </Panel>
</InstantSearch>

Requirements

You should encapsulate the <ColorRefinementList/> component inside a <Panel/> and in an <InstantSearch/> one.

To work properly, you'll need to specify the record attribute corresponding to the color:

Props

NameTypeUse
attribute (required)stringName of the attribute that contains the color
limitnumberNumber of colors to display
showMorebooleanDisplay show more button

Please note that the records' color attributes need to be formatted like grey;#eaeaea (color name and hexadecimal color separated by a semicolon) for the widget to work.

Implementation details

This widget is implemented using the connectRefinementList() connector. To learn more about connectors, you can read the associated guide.

Contributing

To contribute to the project, clone this repository then run:

yarn
yarn start
0.2.6

5 years ago

0.2.5-a

5 years ago

0.2.5

5 years ago

0.2.4

5 years ago

0.2.3

5 years ago

0.2.2

5 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.9

5 years ago

0.1.8

5 years ago

0.1.7

5 years ago

0.1.6-a

5 years ago

0.1.6

5 years ago

0.1.5

5 years ago

0.1.4

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.0

5 years ago