2019-10-20 21:59:16 +02:00
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import React from 'react';
|
|
|
|
import { Link } from 'react-router';
|
2019-10-21 00:37:37 +02:00
|
|
|
import InlineSVG from 'react-inlinesvg';
|
2019-10-20 21:59:16 +02:00
|
|
|
|
2019-10-21 00:37:37 +02: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 21:59:16 +02:00
|
|
|
<li className="collection-popover__item">
|
|
|
|
<div className="collection-popover__item__info">
|
2019-10-21 00:37:37 +02:00
|
|
|
{inCollection && checkIcon}
|
|
|
|
|
2019-10-20 21:59:16 +02: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-21 00:37:37 +02:00
|
|
|
inCollection: PropTypes.bool.isRequired,
|
2019-10-20 21:59:16 +02:00
|
|
|
onSelect: PropTypes.func.isRequired,
|
|
|
|
collection: PropTypes.shape({
|
|
|
|
name: PropTypes.string,
|
|
|
|
}).isRequired,
|
|
|
|
};
|
|
|
|
|
|
|
|
export default CollectionItem;
|