2017-01-24 15:39:41 +02:00
|
|
|
const React = require('react');
|
|
|
|
|
|
|
|
const Tooltip = require('@ui/components/tooltip');
|
|
|
|
|
|
|
|
const tooltipStyle = {
|
|
|
|
position: 'absolute',
|
|
|
|
top: '30px',
|
|
|
|
zIndex: 1
|
|
|
|
};
|
|
|
|
|
|
|
|
const arrowPosition = {
|
|
|
|
bottom: '100%',
|
|
|
|
right: '10%'
|
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = ({
|
2017-01-24 19:27:01 +02:00
|
|
|
handleSelect,
|
2017-01-24 15:39:41 +02:00
|
|
|
person = {},
|
2017-01-25 13:14:49 +02:00
|
|
|
personIndex,
|
2017-01-24 19:27:01 +02:00
|
|
|
options = [],
|
2017-01-24 15:39:41 +02:00
|
|
|
}) => {
|
2017-01-24 19:27:01 +02:00
|
|
|
|
|
|
|
const _options = options.map( (option, i) => {
|
|
|
|
|
2017-01-25 13:14:49 +02:00
|
|
|
const payload = {
|
|
|
|
person: {
|
|
|
|
uuid: person.uuid,
|
|
|
|
status: person.status,
|
|
|
|
role: option
|
|
|
|
},
|
|
|
|
personIndex
|
|
|
|
};
|
|
|
|
|
|
|
|
const _onClick = () => handleSelect(payload);
|
2017-01-24 19:27:01 +02:00
|
|
|
|
|
|
|
return (
|
|
|
|
<li
|
|
|
|
key={i}
|
|
|
|
onClick={_onClick}
|
|
|
|
role="listbox"
|
|
|
|
tabIndex="0"
|
|
|
|
>
|
|
|
|
{option}
|
|
|
|
</li>
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
2017-01-24 15:39:41 +02:00
|
|
|
return (
|
|
|
|
<Tooltip
|
|
|
|
arrowPosition={arrowPosition}
|
|
|
|
key={person.uuid}
|
|
|
|
style={tooltipStyle}
|
|
|
|
>
|
2017-01-24 19:27:01 +02:00
|
|
|
{_options}
|
2017-01-24 15:39:41 +02:00
|
|
|
</Tooltip>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
module.exports.propTypes = {
|
2017-01-24 19:27:01 +02:00
|
|
|
handleSelect: React.PropTypes.func,
|
2017-01-24 15:39:41 +02:00
|
|
|
options: React.PropTypes.array,
|
|
|
|
person: React.PropTypes.object,
|
2017-01-25 13:14:49 +02:00
|
|
|
personIndex: React.PropTypes.number,
|
2017-01-24 15:39:41 +02:00
|
|
|
};
|