<commit_before>import PropTypes from 'prop-types';
import React from 'react';
import {
  InstantSearch,
  ClearAll,
  SearchBox,
  Pagination,
  Highlight,
  Configure,
} from '../packages/react-instantsearch/dom';
import { connectHits } from '../packages/react-instantsearch/connectors';
import { linkTo } from '@storybook/react';
import '../packages/react-instantsearch-theme-algolia/style.scss';

const Wrap = props => (
  <InstantSearch
    appId="latency"
    apiKey="6be0576ff61c053d5f9a3225e2a90f76"
    indexName="ikea"
  >
    {props.children}
  </InstantSearch>
);

Wrap.propTypes = {
  children: PropTypes.node,
};

const WrapWithHits = ({
  searchParameters: askedSearchParameters = {},
  children,
  searchBox = true,
  hasPlayground = false,
  linkedStoryGroup,
  pagination = true,
}) => {
  const sourceCodeUrl = `https://github.com/algolia/react-instantsearch/tree/master/stories/${
    linkedStoryGroup
  }.stories.js`;
  const playgroundLink = hasPlayground ? (
    <button
      onClick={linkTo(linkedStoryGroup, 'playground')}
      className="playground-url"
    >
      <span>Play with props</span>
    </button>
  ) : null;

  const footer = linkedStoryGroup ? (
    <div className="footer-container">
      {playgroundLink}
      <a target="_blank" href={sourceCodeUrl} className="source-code-url">
        <div>View source code</div>
      </a>
    </div>
  ) : null;

  const searchParameters = {
    hitsPerPage: 3,
    ...askedSearchParameters,
  };

  return (
    <InstantSearch
      appId="latency"
      apiKey="6be0576ff61c053d5f9a3225e2a90f76"
      indexName="ikea"
    >
      <Configure {...searchParameters} />
      <div><commit_msg>docs(storybook): allow WrapWithHits usage with a different index (#635)<commit_after>import PropTypes from 'prop-types';
import React from 'react';
import {
  InstantSearch,
  ClearAll,
  SearchBox,
  Pagination,
  Highlight,
  Configure,
} from '../packages/react-instantsearch/dom';
import { connectHits } from '../packages/react-instantsearch/connectors';
import { linkTo } from '@storybook/react';
import '../packages/react-instantsearch-theme-algolia/style.scss';

const Wrap = props => (
  <InstantSearch
    appId="latency"
    apiKey="6be0576ff61c053d5f9a3225e2a90f76"
    indexName="ikea"
  >
    {props.children}
  </InstantSearch>
);

Wrap.propTypes = {
  children: PropTypes.node,
};

const WrapWithHits = ({
  searchParameters: askedSearchParameters = {},
  children,
  searchBox = true,
  hasPlayground = false,
  linkedStoryGroup,
  pagination = true,
  appId = 'latency',
  apiKey = '6be0576ff61c053d5f9a3225e2a90f76',
  indexName = 'ikea',
}) => {
  const sourceCodeUrl = `https://github.com/algolia/react-instantsearch/tree/master/stories/${
    linkedStoryGroup
  }.stories.js`;
  const playgroundLink = hasPlayground ? (
    <button
      onClick={linkTo(linkedStoryGroup, 'playground')}
      className="playground-url"
    >
      <span>Play with props</span>
    </button>
  ) : null;

  const footer = linkedStoryGroup ? (
    <div className="footer-container">
      {playgroundLink}
      <a target="_blank" href={sourceCodeUrl} className="source-code-url">
        <div>View source code</div>
      </a>
    </div>
  ) : null;

  const searchParameters = {
    hitsPerPage: 3,
    ...askedSearchParameters,
  };

  return (
    <InstantSearch appId={appId} apiKey={apiKey} indexName={indexName}>
      <Configure {...searchParameters} />
      <div>
{'fraction_non_alphanumeric': 0.13681159420289854, 'fraction_numerical': 0.025797101449275363, 'mean_word_length': 3.5467720685111987, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 37, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4391313', 'n_tokens_mistral': 1217, 'n_tokens_neox': 1154, 'n_words': 207}