import React from 'react'; import { number, text, withKnobs } from '@storybook/addon-knobs'; import { Icon } from '../../..'; import { MenuItem } from './menu-item.component'; import { Menu } from './menu.component'; export default { title: 'GEENEE-UI/Menu', component: Menu, decorators: [ withKnobs ] }; export const Playground = () => { const menuItemsCount = number('MenuItemsCount', 5); const itemDisabledId = text('Disabled item', '2'); const itemBoldId = text('Bold item', '4'); const [ activeItem, setActiveItem ] = React.useState('0'); const handleChange = (_event: React.SyntheticEvent, menuItemId: string) => { setActiveItem(menuItemId); }; return (
{ Array.from({ length: menuItemsCount }, (_item, index) => ( } id={ `${ index }` } weight={ itemBoldId === `${ index }` ? 'bold' : undefined } disabled={ itemDisabledId === `${ index }` } /> )) }
); }; export const MinimalExampleWithIcons = () => { const [ activeItem, setActiveItem ] = React.useState('0'); const handleChange = (_event: React.SyntheticEvent, menuItemId: string) => { setActiveItem(menuItemId); }; return (
{ Array.from({ length: 4 }, (_item, index) => ( )) }
{ Array.from({ length: 4 }, (_item, index) => ( } id={ `${ index }` } /> )) }
{ Array.from({ length: 4 }, (_item, index) => ( } id={ `${ index }` } /> )) }
); };