File size: 1,799 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 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | import React from 'react';
import { storiesOf } from '@storybook/react';
import { object, number } from '@storybook/addon-knobs';
import { Panel } from 'react-instantsearch-dom';
import Range from './3rdPartyIntegrations.stories';
import { WrapWithHits } from './util';
const stories = storiesOf('RangeSlider', module);
const Warning = () => (
<h3 style={{ marginBottom: 50, textAlign: 'center' }}>
⚠️ This example only works with the version 2.x of Rheostat ️️⚠️
</h3>
);
stories
.add('default', () => (
<WrapWithHits
hasPlayground={true}
linkedStoryGroup="RangeSlider.stories.js"
>
<Warning />
<Range attribute="price" />
</WrapWithHits>
))
.add('providing default value', () => (
<WrapWithHits
hasPlayground={true}
linkedStoryGroup="RangeSlider.stories.js"
>
<Warning />
<Range attribute="price" defaultRefinement={{ min: 50, max: 200 }} />
</WrapWithHits>
))
.add('custom min/max bounds', () => (
<WrapWithHits
hasPlayground={true}
linkedStoryGroup="RangeSlider.stories.js"
>
<Warning />
<Range attribute="price" min={30} max={100} />
</WrapWithHits>
))
.add('with Panel', () => (
<WrapWithHits
hasPlayground={true}
linkedStoryGroup="RangeSlider.stories.js"
>
<Warning />
<Panel header="Range Slider" footer="Footer">
<Range attribute="price" />
</Panel>
</WrapWithHits>
))
.add('playground', () => (
<WrapWithHits linkedStoryGroup="RangeSlider.stories.js">
<Warning />
<Range
attribute="price"
defaultRefinement={object('default value', { min: 150, max: 200 })}
min={number('min', 100)}
max={number('max', 400)}
/>
</WrapWithHits>
));
|