File size: 1,351 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import React from 'react';
import { storiesOf } from '@storybook/react';
import { Panel, Stats, RelevantSort } from 'react-instantsearch-dom';
import { WrapWithHits } from './util';

const stories = storiesOf('Stats', module);

stories
  .add('default', () => (
    <WrapWithHits linkedStoryGroup="Stats.stories.js">
      <div>
        <Stats />
      </div>
    </WrapWithHits>
  ))
  .add('with Panel', () => (
    <WrapWithHits linkedStoryGroup="Stats.stories.js">
      <Panel header="Stats" footer="Footer">
        <Stats />
      </Panel>
    </WrapWithHits>
  ))
  .add('with sorted hits', () => (
    <WrapWithHits
      appId="C7RIRJRYR9"
      apiKey="77af6d5ffb27caa5ff4937099fcb92e8"
      indexName="test_Bestbuy_vr_price_asc"
      linkedStoryGroup="Stats.stories.js"
    >
      <div>
        <Stats />
        <RelevantSort
          textComponent={({ isRelevantSorted }) => (
            <div>
              {isRelevantSorted
                ? 'We removed some search results to show you the most relevant ones'
                : 'Currently showing all results'}
            </div>
          )}
          buttonTextComponent={({ isRelevantSorted }) => (
            <div>
              {isRelevantSorted ? 'See all results' : 'See relevant results'}
            </div>
          )}
        />
      </div>
    </WrapWithHits>
  ));