diff --git a/apps/vr-tests/src/stories/ContextualMenu.stories.tsx b/apps/vr-tests/src/stories/ContextualMenu.stories.tsx index 5e6f6cff36cff..5073b369e47aa 100644 --- a/apps/vr-tests/src/stories/ContextualMenu.stories.tsx +++ b/apps/vr-tests/src/stories/ContextualMenu.stories.tsx @@ -84,6 +84,41 @@ const itemsWithIcons = [ } ]; +const itemsWithSecondaryText = [ + { + key: 'Later Today', + iconProps: { + iconName: 'Clock' + }, + name: 'Later Today', + secondaryText: '7:00 PM' + }, + { + key: 'Tomorrow', + iconProps: { + iconName: 'Coffeescript' + }, + name: 'Tomorrow', + secondaryText: 'Thu. 8:00 AM' + }, + { + key: 'This Weekend', + iconProps: { + iconName: 'Vacation' + }, + name: 'This Weekend', + secondaryText: 'Sat. 10:00 AM' + }, + { + key: 'Next Week', + iconProps: { + iconName: 'Suitcase' + }, + name: 'Next Week', + secondaryText: 'Mon. 8:00 AM' + } +]; + const itemsWithSubmenu = [ { key: 'newItem', @@ -219,7 +254,6 @@ const itemsWithSplitButtonSubmenu = [ } ]; - storiesOf('ContextualMenu', module) .addDecorator(FabricDecorator) .addDecorator(story => ( @@ -247,6 +281,11 @@ storiesOf('ContextualMenu', module) items={ itemsWithIcons } /> )) + .add('With secondaryText', () => ( + + )) .add('With submenu', () => ( { return null; }; +const renderSecondaryText = ({ item, classNames }: IContextualMenuItemProps) => { + if (item.secondaryText) { + return { item.secondaryText }; + } + return null; +}; + const renderSubMenuIcon = ({ item, classNames }: IContextualMenuItemProps) => { if (hasSubmenu(item)) { return ( @@ -81,6 +88,7 @@ export class ContextualMenuItem extends BaseComponent ); @@ -109,4 +117,4 @@ export class ContextualMenuItem extends BaseComponent + + + , null, + null, , null, + null, , null, null, + null, ], "className": "linkContent", }, @@ -339,6 +351,7 @@ ShallowWrapper { }, null, null, + null, ], "type": "div", }, @@ -355,6 +368,7 @@ ShallowWrapper { />, null, null, + null, ], "className": "linkContent", }, @@ -374,6 +388,7 @@ ShallowWrapper { }, null, null, + null, ], "type": "div", }, @@ -403,6 +418,7 @@ ShallowWrapper { "linkContent": "linkContent", "linkContentMenu": "linkContentMenu", "root": "root", + "secondaryText": "secondaryText", "splitContainer": "splitContainer", "splitMenu": "splitMenu", "splitPrimary": "splitPrimary", @@ -443,6 +459,7 @@ ShallowWrapper { menuItem , null, + null, ], "className": "linkContent", }, @@ -474,6 +491,7 @@ ShallowWrapper { "type": "span", }, null, + null, ], "type": "div", }, @@ -495,6 +513,7 @@ ShallowWrapper { menuItem , null, + null, ], "className": "linkContent", }, @@ -526,6 +545,7 @@ ShallowWrapper { "type": "span", }, null, + null, ], "type": "div", }, diff --git a/packages/office-ui-fabric-react/src/components/ContextualMenu/examples/ContextualMenu.Icon.SecondaryText.Example.tsx b/packages/office-ui-fabric-react/src/components/ContextualMenu/examples/ContextualMenu.Icon.SecondaryText.Example.tsx new file mode 100644 index 0000000000000..b691e2fb1e93d --- /dev/null +++ b/packages/office-ui-fabric-react/src/components/ContextualMenu/examples/ContextualMenu.Icon.SecondaryText.Example.tsx @@ -0,0 +1,61 @@ +import * as React from 'react'; +import { DefaultButton } from 'office-ui-fabric-react/lib/Button'; + +export class ContextualMenuIconSecondaryTextExample extends React.Component<{}, { showCallout: boolean }> { + + constructor(props: {}) { + super(props); + this.state = { + showCallout: false + }; + } + + public render(): JSX.Element { + return ( +
+ +
+ ); + } +}