2016-01-26 16:59:57 +03:00
|
|
|
import React from 'react';
|
2016-05-22 20:08:47 +03:00
|
|
|
import { themr } from 'react-css-themr';
|
2016-01-27 13:21:03 +03:00
|
|
|
import ListItemAction from './ListItemAction';
|
2016-01-26 16:59:57 +03:00
|
|
|
|
2016-05-22 20:08:47 +03:00
|
|
|
const ListItemActions = ({type, children, theme}) => {
|
2016-01-26 16:59:57 +03:00
|
|
|
const validChildren = React.Children.toArray(children).filter(c => (
|
|
|
|
React.isValidElement(c)
|
|
|
|
));
|
|
|
|
|
|
|
|
return (
|
2016-05-22 20:08:47 +03:00
|
|
|
<span className={theme[type]}>
|
2016-01-27 13:21:03 +03:00
|
|
|
{validChildren.map((action, i) => <ListItemAction key={i} action={action} />)}
|
2016-01-26 16:59:57 +03:00
|
|
|
</span>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
ListItemActions.propTypes = {
|
|
|
|
children: React.PropTypes.any,
|
2016-05-22 20:08:47 +03:00
|
|
|
theme: React.PropTypes.shape({
|
|
|
|
left: React.PropTypes.string.isRequired,
|
|
|
|
right: React.PropTypes.string.isRequired
|
|
|
|
}),
|
2016-01-26 16:59:57 +03:00
|
|
|
type: React.PropTypes.oneOf(['left', 'right'])
|
|
|
|
};
|
|
|
|
|
2016-05-22 20:08:47 +03:00
|
|
|
export default themr('ToolboxList')(ListItemActions);
|