2017-11-07 18:16:42 +01:00
|
|
|
/**
|
2019-07-02 08:37:41 +02:00
|
|
|
*
|
|
|
|
* InputSearchLi
|
|
|
|
*
|
|
|
|
*/
|
2017-11-07 18:16:42 +01:00
|
|
|
|
|
|
|
import React from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
2019-09-17 16:20:45 +02:00
|
|
|
|
|
|
|
import { Wrapper } from './Components';
|
2017-11-07 18:16:42 +01:00
|
|
|
|
2017-11-23 13:09:05 +01:00
|
|
|
function InputSearchLi({ onClick, isAdding, item }) {
|
|
|
|
const icon = isAdding ? 'fa-plus' : 'fa-minus-circle';
|
2017-11-29 12:36:35 +01:00
|
|
|
const liStyle = isAdding ? { cursor: 'pointer' } : {};
|
|
|
|
const handleClick = isAdding ? () => onClick(item) : () => {};
|
2017-12-14 16:15:32 +01:00
|
|
|
const path = `/admin/plugins/content-manager/user/${item.id}?redirectUrl=/plugins/content-manager/user/?page=1&limit=20&sort=id&source=users-permissions`;
|
2017-11-23 13:09:05 +01:00
|
|
|
|
2017-11-07 18:16:42 +01:00
|
|
|
return (
|
2019-09-17 16:20:45 +02:00
|
|
|
<Wrapper style={liStyle} onClick={handleClick}>
|
2017-11-07 18:16:42 +01:00
|
|
|
<div>
|
2019-09-17 16:20:45 +02:00
|
|
|
<div>
|
2017-11-27 14:26:54 +01:00
|
|
|
{item.username}
|
2019-07-02 08:37:41 +02:00
|
|
|
<a href={`${path}`} target="_blank" rel="noopener noreferrer">
|
2017-12-05 14:44:32 +01:00
|
|
|
<i className="fa fa-external-link" />
|
|
|
|
</a>
|
2017-11-07 18:16:42 +01:00
|
|
|
</div>
|
2017-11-29 12:36:35 +01:00
|
|
|
<div
|
2019-07-02 08:37:41 +02:00
|
|
|
onClick={e => {
|
2017-11-29 12:36:35 +01:00
|
|
|
e.stopPropagation();
|
|
|
|
e.preventDefault();
|
|
|
|
onClick(item);
|
|
|
|
}}
|
|
|
|
>
|
2017-11-23 13:09:05 +01:00
|
|
|
<i className={`fa ${icon}`} />
|
2017-11-07 18:16:42 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
2019-09-17 16:20:45 +02:00
|
|
|
</Wrapper>
|
2017-11-07 18:16:42 +01:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
InputSearchLi.defaultProps = {
|
|
|
|
item: {
|
|
|
|
name: '',
|
2017-11-08 16:06:21 +01:00
|
|
|
},
|
|
|
|
};
|
2017-11-07 18:16:42 +01:00
|
|
|
|
2017-11-08 16:06:21 +01:00
|
|
|
InputSearchLi.propTypes = {
|
2017-11-23 13:09:05 +01:00
|
|
|
isAdding: PropTypes.bool.isRequired,
|
2017-11-07 18:16:42 +01:00
|
|
|
item: PropTypes.object,
|
2017-11-23 13:09:05 +01:00
|
|
|
onClick: PropTypes.func.isRequired,
|
2017-11-07 18:16:42 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
export default InputSearchLi;
|