diff --git a/src/components/top-bar/top-bar.tsx b/src/components/top-bar/top-bar.tsx index b677b21f..9cd81191 100644 --- a/src/components/top-bar/top-bar.tsx +++ b/src/components/top-bar/top-bar.tsx @@ -30,7 +30,7 @@ export interface Toolbar { breadcrumbs?: { title: string | React.ReactNode, path?: string; }[]; tools?: React.ReactNode; actionMenu?: ActionMenu; - toolBarExtensions?: React.ReactNode[]; + actionMenuExtensions?: React.ReactNode[]; } export interface TopBarProps extends React.Props { @@ -86,7 +86,7 @@ const renderBreadcrumbs = (breadcrumbs: { title: string | React.ReactNode, path? ); -const renderActionMenu = (actionMenu: ActionMenu, toolBarExts: React.ReactNode[]) => ( +const renderActionMenu = (actionMenu: ActionMenu, actionMenuExtensions: React.ReactNode[]) => (
{actionMenu.items.map((item, i) => ( ))} - {toolBarExts && toolBarExts.map((ext, index) => ( + {actionMenuExtensions && actionMenuExtensions.map((ext, index) => ( {ext} ))}
@@ -103,7 +103,7 @@ const renderActionMenu = (actionMenu: ActionMenu, toolBarExts: React.ReactNode[] const renderToolbar = (toolbar: Toolbar) => (
- {toolbar.actionMenu && renderActionMenu(toolbar.actionMenu, toolbar.toolBarExtensions)} + {toolbar.actionMenu && renderActionMenu(toolbar.actionMenu, toolbar.actionMenuExtensions)}
diff --git a/stories/top-bar.stories.tsx b/stories/top-bar.stories.tsx new file mode 100644 index 00000000..f66fcb49 --- /dev/null +++ b/stories/top-bar.stories.tsx @@ -0,0 +1,15 @@ +import { storiesOf } from '@storybook/react'; +import * as React from 'react'; +import { TopBar } from '../src/components/top-bar/top-bar'; + + +storiesOf('TopBar', module) + .add('basic tabs', () => ( + + )) + .add('with actions menu', () => ( + alert(' here' ), title: "click here" }] } }} /> + )) + .add('with extension menu', () => ( + alert(' here' ), title: "click here" }] }, actionMenuExtensions: [render the custom component] }} /> + )); \ No newline at end of file