import React from 'react'; import PropTypes from 'prop-types'; import { storiesOf } from '@storybook/react'; import { action } from '@storybook/addon-actions'; import { Hits, Highlight, Panel, Snippet, Configure, } from 'react-instantsearch-dom'; import { connectHitInsights } from 'react-instantsearch-core'; import { WrapWithHits } from './util'; const stories = storiesOf('Hits', module); stories .add('default', () => ( )) .add('with custom rendering', () => { function Product({ hit }) { return (

); } Product.propTypes = { hit: PropTypes.object.isRequired, }; return ( ); }) .add('with Panel', () => ( )) .add('with Insights', () => { const insightsClient = (method, payload) => action(`[InsightsClient] sent ${method} with payload`)(payload); const ProductWithInsights = connectHitInsights(insightsClient)(Product); function Product({ hit, insights }) { return (
); } Product.propTypes = { hit: PropTypes.object.isRequired, insights: PropTypes.func.isRequired, }; return ( ); });