Skip to content

Commit

Permalink
only show delete icon if big enough
Browse files Browse the repository at this point in the history
  • Loading branch information
Mary Hipp authored and Mary Hipp committed Jul 5, 2023
1 parent 818616a commit 840c8cf
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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();

Expand Down Expand Up @@ -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' }}
Expand Down

0 comments on commit 840c8cf

Please sign in to comment.