2019-10-20 19:59:16 +00:00
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import React from 'react';
|
|
|
|
import { Link } from 'react-router';
|
2019-10-20 22:37:37 +00:00
|
|
|
import InlineSVG from 'react-inlinesvg';
|
2019-10-20 19:59:16 +00:00
|
|
|
|
2019-10-20 22:37:37 +00:00
|
|
|
import check from '../../../../images/check.svg';
|
|
|
|
|
|
|
|
const checkIcon = (
|
|
|
|
<InlineSVG className="sketch-list__check-icon" src={check} alt="In collection" />
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
const CollectionItem = ({ inCollection, collection, onSelect }) => (
|
2019-10-20 19:59:16 +00:00
|
|
|
<li className="collection-popover__item">
|
|
|
|
<div className="collection-popover__item__info">
|
2019-10-20 22:37:37 +00:00
|
|
|
{inCollection && checkIcon}
|
|
|
|
|
2019-10-20 19:59:16 +00:00
|
|
|
<button onClick={onSelect}>
|
|
|
|
{collection.name}
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div className="collection-popover__item__view">
|
|
|
|
<Link className="collection-popover__item__view-button" to={`/${collection.owner.username}/collections/${collection.id}`}>View</Link>
|
|
|
|
</div>
|
|
|
|
</li>
|
|
|
|
);
|
|
|
|
|
|
|
|
CollectionItem.propTypes = {
|
2019-10-20 22:37:37 +00:00
|
|
|
inCollection: PropTypes.bool.isRequired,
|
2019-10-20 19:59:16 +00:00
|
|
|
onSelect: PropTypes.func.isRequired,
|
|
|
|
collection: PropTypes.shape({
|
|
|
|
name: PropTypes.string,
|
|
|
|
}).isRequired,
|
|
|
|
};
|
|
|
|
|
|
|
|
export default CollectionItem;
|