Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Tab): relax menuItem prop type #1823

Merged
merged 1 commit into from
Jun 30, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions docs/app/Examples/modules/Tab/Usage/TabExampleCustomMenuItem.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import React from 'react'
import { Label, Menu, Tab } from 'semantic-ui-react'

const panes = [
{
menuItem: { key: 'users', icon: 'users', content: 'Users' },
render: () => <Tab.Pane>Tab 1 Content</Tab.Pane>,
},
{
menuItem: <Menu.Item key='messages'>Messages<Label>15</Label></Menu.Item>,
render: () => <Tab.Pane>Tab 2 Content</Tab.Pane>,
},
]

const TabExampleCustomMenuItem = () => (
<Tab panes={panes} />
)

export default TabExampleCustomMenuItem
5 changes: 5 additions & 0 deletions docs/app/Examples/modules/Tab/Usage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ const TabUsageExamples = () => (
description='You can capture the tab change event.'
examplePath='modules/Tab/Usage/TabExampleOnTabChange'
/>
<ComponentExample
title='Custom Menu Items'
description='You can pass any shorthand value as a menu item.'
examplePath='modules/Tab/Usage/TabExampleCustomMenuItem'
/>
</ExampleSection>
)

Expand Down
2 changes: 1 addition & 1 deletion src/modules/Tab/Tab.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class Tab extends Component {
* }
*/
panes: PropTypes.arrayOf(PropTypes.shape({
menuItem: PropTypes.string.isRequired,
menuItem: customPropTypes.itemShorthand,
render: PropTypes.func.isRequired,
})),
}
Expand Down