import React from 'react' import PropTypes from 'prop-types' import {storiesOf} from '@storybook/react' import 'whatwg-fetch' import {Clear, Select, Item, Label, Search, List, TagList, Tag} from '../src' import { rendering, renderingList, renderingItem, renderingSearch, renderingTag, onChange, } from './utils/dummy' const createQuery = query => query === '' ? 'https://swapi.co/api/people' : `https://swapi.co/api/people/?search=${query}` const fakeApiCb = (query, cb) => fakeApi(query).then(r => cb(null, r)) const fakeApi = query => fetch(createQuery(query)) .then(response => response.json()) .then(r => r.results) const Container = props => storiesOf('Async', module) .add('With callback', () => ({label: data.name, value: data.name})}> ) .add('With promise', () => ({label: data.name, value: data.name})}>
) .add('With custom debounce', () => ({label: data.name, value: data.name})}>
} />
)