// @flow
import React from 'react';
import Button from 'component/button';
import * as ICONS from 'constants/icons';
type Props = {
collectionIndex?: number,
editCollection: (string, CollectionEditParams) => void,
listId?: string,
lastCollectionIndex?: number,
claim: ?Claim,
};
function CollectionButtons(props: Props) {
const { collectionIndex, editCollection, listId, lastCollectionIndex, claim } = props;
const [confirmDelete, setConfirmDelete] = React.useState(false);
return (
{
e.preventDefault();
e.stopPropagation();
if (editCollection) {
// $FlowFixMe
editCollection(listId, {
order: { from: collectionIndex, to: Number(collectionIndex) - 1 },
});
}
}}
/>
{
e.preventDefault();
e.stopPropagation();
if (editCollection) {
// $FlowFixMe
editCollection(listId, {
order: { from: collectionIndex, to: Number(collectionIndex + 1) },
});
}
}}
/>
{!confirmDelete && (
{
setConfirmDelete(true);
}}
/>
)}
{confirmDelete && (
{
setConfirmDelete(false);
}}
/>
{
e.preventDefault();
e.stopPropagation();
// $FlowFixMe
if (editCollection) editCollection(listId, { claims: [claim], remove: true });
}}
/>
)}
);
}
export default CollectionButtons;