Skip to content

Commit

Permalink
fix(Dropdown): use item instead of as={Menu.Item} (Semantic-Org#659)
Browse files Browse the repository at this point in the history
fix(Dropdown): use `item` instead of `as={Menu.Item}`
  • Loading branch information
levithomason authored and harel committed Feb 18, 2017
1 parent 2598fc4 commit 32afa40
Show file tree
Hide file tree
Showing 13 changed files with 17 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Dropdown, Menu } from 'semantic-ui-react'
const MenuExampleDropdownItem = () => {
return (
<Menu vertical>
<Dropdown as={Menu.Item} text='Categories'>
<Dropdown item text='Categories'>
<Dropdown.Menu>
<Dropdown.Item>Electronics</Dropdown.Item>
<Dropdown.Item>Automotive</Dropdown.Item>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default class MenuExampleSubMenu extends Component {
Messages
</Menu.Item>

<Dropdown as={Menu.Item} text='More'>
<Dropdown item text='More'>
<Dropdown.Menu>
<Dropdown.Item icon='edit' text='Edit Profile' />
<Dropdown.Item icon='globe' text='Choose Language' />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const MenuExampleAttached = () => {
return (
<div>
<Menu attached='top'>
<Dropdown as={Menu.Item} icon='wrench' simple>
<Dropdown item icon='wrench' simple>
<Dropdown.Menu>
<Dropdown.Item>
<Icon name='dropdown' />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default class MenuExampleVerticalDropdown extends Component {
<Menu secondary vertical>
<Menu.Item name='account' active={activeItem === 'account'} onClick={this.handleItemClick} />
<Menu.Item name='settings' active={activeItem === 'settings'} onClick={this.handleItemClick} />
<Dropdown as={Menu.Item} text='Display Options'>
<Dropdown item text='Display Options'>
<Dropdown.Menu>
<Dropdown.Header>Text Size</Dropdown.Header>
<Dropdown.Item>Small</Dropdown.Item>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default class MenuExampleSizeHuge extends Component {
<Menu.Item name='messages' active={activeItem === 'messages'} onClick={this.handleItemClick} />

<Menu.Menu position='right'>
<Dropdown as={Menu.Item} text='Language'>
<Dropdown item text='Language'>
<Dropdown.Menu>
<Dropdown.Item>English</Dropdown.Item>
<Dropdown.Item>Russian</Dropdown.Item>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default class MenuExampleSizeLarge extends Component {
<Menu.Item name='messages' active={activeItem === 'messages'} onClick={this.handleItemClick} />

<Menu.Menu position='right'>
<Dropdown as={Menu.Item} text='Language'>
<Dropdown item text='Language'>
<Dropdown.Menu>
<Dropdown.Item>English</Dropdown.Item>
<Dropdown.Item>Russian</Dropdown.Item>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default class MenuExampleSizeMassive extends Component {
<Menu.Item name='messages' active={activeItem === 'messages'} onClick={this.handleItemClick} />

<Menu.Menu position='right'>
<Dropdown as={Menu.Item} text='Language'>
<Dropdown item text='Language'>
<Dropdown.Menu>
<Dropdown.Item>English</Dropdown.Item>
<Dropdown.Item>Russian</Dropdown.Item>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default class MenuExampleSizeMini extends Component {
<Menu.Item name='messages' active={activeItem === 'messages'} onClick={this.handleItemClick} />

<Menu.Menu position='right'>
<Dropdown as={Menu.Item} text='Language'>
<Dropdown item text='Language'>
<Dropdown.Menu>
<Dropdown.Item>English</Dropdown.Item>
<Dropdown.Item>Russian</Dropdown.Item>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default class MenuExampleSizeSmall extends Component {
<Menu.Item name='messages' active={activeItem === 'messages'} onClick={this.handleItemClick} />

<Menu.Menu position='right'>
<Dropdown as={Menu.Item} text='Language'>
<Dropdown item text='Language'>
<Dropdown.Menu>
<Dropdown.Item>English</Dropdown.Item>
<Dropdown.Item>Russian</Dropdown.Item>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default class MenuExampleSizeTiny extends Component {
<Menu.Item name='messages' active={activeItem === 'messages'} onClick={this.handleItemClick} />

<Menu.Menu position='right'>
<Dropdown as={Menu.Item} text='Language'>
<Dropdown item text='Language'>
<Dropdown.Menu>
<Dropdown.Item>English</Dropdown.Item>
<Dropdown.Item>Russian</Dropdown.Item>
Expand Down
1 change: 1 addition & 0 deletions src/collections/Menu/Menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ const _meta = {

/**
* A menu displays grouped navigation actions.
* @see Dropdown
*/
class Menu extends Component {
static propTypes = {
Expand Down
9 changes: 5 additions & 4 deletions src/modules/Dropdown/Dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ const _meta = {
* A dropdown allows a user to select a value from a series of options.
* @see Form
* @see Select
* @see Menu
*/
export default class Dropdown extends Component {
static propTypes = {
Expand Down Expand Up @@ -136,7 +137,8 @@ export default class Dropdown extends Component {
/** A dropdown can be labeled. */
labeled: PropTypes.bool,

// linkItem: PropTypes.bool,
/** A dropdown can be formatted as a Menu item. */
item: PropTypes.bool,

/** A dropdown can show that it is currently loading data. */
loading: PropTypes.bool,
Expand Down Expand Up @@ -1140,8 +1142,8 @@ export default class Dropdown extends Component {
floating,
icon,
inline,
item,
labeled,
// linkItem,
multiple,
pointing,
search,
Expand Down Expand Up @@ -1174,8 +1176,7 @@ export default class Dropdown extends Component {
// TODO: the icon class is only required when a dropdown is a button
// useKeyOnly(icon, 'icon'),
useKeyOnly(labeled, 'labeled'),
// TODO: linkItem is required only when Menu child, add dynamically
// useKeyOnly(linkItem, 'link item'),
useKeyOnly(item, 'item'),
useKeyOnly(multiple, 'multiple'),
useKeyOnly(search, 'search'),
useKeyOnly(selection, 'selection'),
Expand Down
3 changes: 1 addition & 2 deletions test/specs/modules/Dropdown/Dropdown-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,7 @@ describe('Dropdown Component', () => {
// TODO: See Dropdown cx notes
// common.propKeyOnlyToClassName(Dropdown, 'icon')
common.propKeyOnlyToClassName(Dropdown, 'labeled')
// TODO: See Dropdown cx notes
// common.propKeyOnlyToClassName(Dropdown, 'link item')
common.propKeyOnlyToClassName(Dropdown, 'item')
common.propKeyOnlyToClassName(Dropdown, 'multiple')
common.propKeyOnlyToClassName(Dropdown, 'search')
common.propKeyOnlyToClassName(Dropdown, 'selection')
Expand Down

0 comments on commit 32afa40

Please sign in to comment.