import React from 'react'; import {withInfo} from '@storybook/addon-info'; import AutoComplete from 'app/components/autoComplete'; const items = [ { name: 'Apple', }, { name: 'Pineapple', }, { name: 'Orange', }, ]; export default { title: 'UI/AutoComplete', }; export const Input = withInfo('Autocomplete on an input')(() => ( item.name}> {({ getRootProps, getInputProps, getMenuProps, getItemProps, inputValue, highlightedIndex, isOpen, }) => { return (
{isOpen && (
{items .filter( item => item.name.toLowerCase().indexOf(inputValue.toLowerCase()) > -1 ) .map((item, index) => (
{item.name}
))}
)}
); }}
));