import React from 'react'; import { number, optionsKnob, withKnobs } from '@storybook/addon-knobs'; import { Icon } from '../../..'; import { OptionsKnobRecord } from '../../util/knobs'; import { TabsItem } from './tabs-item.component'; import { TabsPanelContainer } from './tabs-panel-container.component'; import { TabsPanel } from './tabs-panel.component'; import { Tabs, TabsPropsType } from './tabs.component'; export default { title: 'GEENEE-UI/Tabs', component: Tabs, decorators: [ withKnobs ] }; export const Playground = () => { const [ activeTab, setActiveTab ] = React.useState('0'); const handleChange = (_event: React.MouseEvent, newTabId: string) => { setActiveTab(newTabId); }; const tabsCount = number('TabsCount', 6); const width = number('width', 700); const height = number('height', 450); return (

Scrollable tabs

{ Array.from({ length: tabsCount }, (item, index) => ( List { ' ' } { index }
) } tabId={ `${ index }` } key={ `${ index }` } disabled={ index === number('Disabled index', -1) } /> )) } } tabId="other-add" /> { Array.from({ length: tabsCount }, (item, index) => (
{ `Content tab ${ index }` }
)) }
); }; const tabsOrientation: OptionsKnobRecord = { default: undefined, vertical: 'vertical', horizontal: 'horizontal' }; export const Vertical = () => { const [ activeTab, setActiveTab ] = React.useState('0'); const handleChange = (_event: React.MouseEvent, newTabId: string) => { setActiveTab(newTabId); }; const tabsCount = number('TabsCount', 15); const width = number('width', 700); const height = number('height', 350); const orientation = optionsKnob('Orientation', tabsOrientation, 'vertical', { display: 'select' }); return (

Vertical tabs

{ Array.from({ length: tabsCount }, (item, index) => ( Other List { ' ' } { index }
) } tabId={ `other-${ index }` } key={ `other-${ index }` } /> )) } { Array.from({ length: tabsCount }, (_item, index) => ( { `Content tab other-${ index }` } )) }
); };