fix: Don't show drag handle on pins when there is only 1

This commit is contained in:
Tom Moor
2022-01-20 20:18:28 -08:00
parent c2c7a7190c
commit 8c6ab3db37
2 changed files with 12 additions and 4 deletions

View File

@@ -18,15 +18,20 @@ import CollectionIcon from "./CollectionIcon";
import Tooltip from "./Tooltip";
type Props = {
/** The pin record */
pin: Pin | undefined;
/** The document related to the pin */
document: Document;
/** Whether the user has permission to delete or reorder the pin */
canUpdatePin?: boolean;
/** Whether this pin can be reordered by dragging */
isDraggable?: boolean;
};
function DocumentCard(props: Props) {
const { t } = useTranslation();
const { collections } = useStores();
const { document, pin, canUpdatePin } = props;
const { document, pin, canUpdatePin, isDraggable } = props;
const collection = collections.get(document.collectionId);
const {
attributes,
@@ -105,9 +110,11 @@ function DocumentCard(props: Props) {
</PinButton>
</Tooltip>
)}
<DragHandle $isDragging={isDragging} {...listeners}>
:::
</DragHandle>
{isDraggable && (
<DragHandle $isDragging={isDragging} {...listeners}>
:::
</DragHandle>
)}
</Actions>
)}
</AnimatePresence>