import * as React from 'react';
import {withInfo} from '@storybook/addon-info';
import {boolean, select, withKnobs} from '@storybook/addon-knobs';
import {DropDown} from './DropDown';
import {iconMap, placementMap} from '../../utils/storybookEnums';
import {INTENT, PLACEMENT, POPOVER_BOUNDARIES} from '../../constants';
import {storyLayout} from '../../index.stories';
import {Button} from '../button/Button';
// eslint-disable-next-line no-restricted-syntax
export default {
title: 'DropDown',
decorators: [withInfo, withKnobs, storyLayout]
};
export const simpleDropDown = () => {
const [isOpen, toggleOpen] = React.useState(false);
return (
<>
)}
placement={select('placement', placementMap(true), PLACEMENT.BOTTOM_START)}
>
<>
first
second
last
>
DropDown with navigation
)}
onVisibleChange={toggleOpen}
placement={select('placement', placementMap(true), PLACEMENT.BOTTOM_START)}
boundaries={POPOVER_BOUNDARIES.VIEWPORT}
hasNavigation={true}
>
Header1
first
second
pre-last
Header2
last
>
);
};
export const dropDownItems = () => {
const renderItem = (text: string) => {
return (
{text}
);
};
return (
}
isOpen={true}
>
{renderItem('Item text 1')}
{renderItem('Item text 2')}
{renderItem('Item text 3')}
);
};