-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #217 from TechnologyAdvice/feature/common-tests
Create common tests
- Loading branch information
Showing
38 changed files
with
831 additions
and
509 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,48 @@ | ||
import React, { Component, PropTypes } from 'react' | ||
import React, { PropTypes } from 'react' | ||
import classNames from 'classnames' | ||
import META from '../../utils/Meta' | ||
|
||
export default class MenuItem extends Component { | ||
static propTypes = { | ||
activeItem: PropTypes.string, | ||
callbackParent: PropTypes.func, | ||
children: PropTypes.node, | ||
className: PropTypes.string, | ||
label: PropTypes.oneOfType([ | ||
PropTypes.number, | ||
PropTypes.string, | ||
]), | ||
name: PropTypes.string, | ||
onClick: PropTypes.func, | ||
const MenuItem = ({ __onClick, active, children, className, label, name, onClick, ...rest }) => { | ||
const handleClick = (e) => { | ||
__onClick(name) | ||
if (onClick) onClick(name) | ||
} | ||
|
||
handleClick = e => { | ||
if (this.props.onClick) { | ||
this.props.onClick(this.props.name) | ||
} | ||
this.props.callbackParent(this.props.name) | ||
} | ||
const menuLabel = label && <div className='sd-menu-label ui blue label'>{label}</div> | ||
const classes = classNames( | ||
'sd-menu-item', | ||
active && 'active', | ||
className, | ||
'item', | ||
) | ||
|
||
static _meta = { | ||
library: META.library.semanticUI, | ||
name: 'MenuItem', | ||
type: META.type.collection, | ||
parent: 'Menu', | ||
} | ||
return ( | ||
<a {...rest} className={classes} onClick={handleClick}> | ||
{name} | ||
{menuLabel} | ||
{children} | ||
</a> | ||
) | ||
} | ||
|
||
render() { | ||
const menuLabel = <div className='sd-menu-label ui blue label'>{this.props.label}</div> | ||
const isActive = this.props.activeItem === this.props.name | ||
const classes = classNames( | ||
'sd-menu-item', | ||
this.props.className, | ||
'item', | ||
{ active: isActive } | ||
) | ||
return ( | ||
<a {...this.props} className={classes} onClick={this.handleClick}> | ||
{this.props.name} | ||
{this.props.label && menuLabel} | ||
{this.props.children} | ||
</a> | ||
) | ||
} | ||
MenuItem._meta = { | ||
library: META.library.semanticUI, | ||
name: 'MenuItem', | ||
type: META.type.collection, | ||
parent: 'Menu', | ||
} | ||
|
||
MenuItem.propTypes = { | ||
__onClick: PropTypes.func, | ||
active: PropTypes.bool, | ||
children: PropTypes.node, | ||
className: PropTypes.string, | ||
label: PropTypes.oneOfType([ | ||
PropTypes.number, | ||
PropTypes.string, | ||
]), | ||
name: PropTypes.string, | ||
onClick: PropTypes.func, | ||
} | ||
|
||
export default MenuItem |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,22 @@ | ||
import React, { Component, PropTypes } from 'react' | ||
import classNames from 'classnames' | ||
import React, { PropTypes } from 'react' | ||
import META from '../../utils/Meta' | ||
|
||
export default class TableColumn extends Component { | ||
static propTypes = { | ||
cellRenderer: PropTypes.func, | ||
className: PropTypes.string, | ||
dataKey: PropTypes.string, | ||
headerRenderer: PropTypes.func, | ||
} | ||
// This is an abstract component | ||
// it is only used by the user to configure a Table | ||
const TableColumn = (props) => <noscript /> | ||
|
||
static _meta = { | ||
library: META.library.semanticUI, | ||
name: 'TableColumn', | ||
type: META.type.collection, | ||
parent: 'Table', | ||
} | ||
TableColumn.propTypes = { | ||
cellRenderer: PropTypes.func, | ||
className: PropTypes.string, | ||
dataKey: PropTypes.string, | ||
headerRenderer: PropTypes.func, | ||
} | ||
|
||
render() { | ||
const classes = classNames( | ||
'sd-table-column', | ||
this.props.className | ||
) | ||
return <div {...this.props} className={classes}></div> | ||
} | ||
TableColumn._meta = { | ||
library: META.library.semanticUI, | ||
name: 'TableColumn', | ||
type: META.type.collection, | ||
parent: 'Table', | ||
} | ||
|
||
export default TableColumn |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import React, { PropTypes } from 'react' | ||
import cx from 'classnames' | ||
import META from '../../utils/Meta' | ||
|
||
const ItemItems = (props) => { | ||
const { className, children, ...rest } = props | ||
const classes = cx('sd-item-items ui', className, 'items') | ||
|
||
return <div {...rest} className={classes}>{children}</div> | ||
} | ||
|
||
ItemItems.propTypes = { | ||
children: PropTypes.node, | ||
className: PropTypes.string, | ||
} | ||
|
||
ItemItems._meta = { | ||
library: META.library.semanticUI, | ||
name: 'ItemItems', | ||
type: META.type.view, | ||
parent: 'Item', | ||
} | ||
|
||
export default ItemItems |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.