only show delete icon if big enough

This commit is contained in:
Mary Hipp 2023-07-05 10:47:20 -04:00 committed by psychedelicious
parent 405054d802
commit 984121d682

View File

@ -23,9 +23,11 @@ export const makeSelector = (image_name: string) =>
({ gallery }) => {
const isSelected = gallery.selection.includes(image_name);
const selectionCount = gallery.selection.length;
const galleryImageMinimumWidth = gallery.galleryImageMinimumWidth;
return {
isSelected,
selectionCount,
galleryImageMinimumWidth,
};
},
defaultSelectorOptions
@ -44,7 +46,8 @@ const GalleryImage = (props: HoverableImageProps) => {
const localSelector = useMemo(() => makeSelector(image_name), [image_name]);
const { isSelected, selectionCount } = useAppSelector(localSelector);
const { isSelected, selectionCount, galleryImageMinimumWidth } =
useAppSelector(localSelector);
const dispatch = useAppDispatch();
@ -113,7 +116,9 @@ const GalleryImage = (props: HoverableImageProps) => {
draggableData={draggableData}
isSelected={isSelected}
minSize={0}
onClickReset={handleDelete}
onClickReset={
galleryImageMinimumWidth > 60 ? handleDelete : undefined
}
resetIcon={<FaTrash />}
resetTooltip="Delete image"
imageSx={{ w: 'full', h: 'full' }}