import React, { Component } from 'react'; import { storiesOf } from '@storybook/react'; import { boolean } from '@storybook/addon-knobs'; import BikeFilledIcon from 'components/Icon/icons/vehicles/bikeFilled'; import Select from './index'; import BaseApp from '../BaseApp'; const items = [ { value: 'MOTORCYCLE', label: 'Motorcycle', }, { value: 'VAN', label: 'Van', }, ]; const itemsWithIcons = items.map(item => ({ ...item, icon: , })); const itemsWithDisabledItem = [ { id: 'MOTORCYCLE', value: 'Motorcycle', disabled: true, }, { id: 'VAN', value: 'Van', }, ]; const longItems = itemsWithIcons.map(item => ({ ...item, label: 'Lorem ipsum dolor sit amet consectetur adipisicing elit. Itaque, distinctio.', })); class Wrapper extends Component { state = { select1: null, select2: null, select3: items[0], select4: null, select5: null, select6: null, select7: null, }; handleOnChange = (selectedItem, name) => { this.setState({ [name]: selectedItem }); }; render() { const { select1, select2, select3, select4, select5, select6, select7, } = this.state; const rtl = boolean('Right-to-left', false); return (

Basic

this.handleOnChange(selected, 'select2')} />

With error message

this.handleOnChange(selected, 'select4')} />

With disabled item

this.handleOnChange(selected, 'select6')} renderStrategy="portal" />

With preventOverflowViewport