From d919022ba51ed505e150ddf9fb151a904df4dfdc Mon Sep 17 00:00:00 2001 From: Rohinish Date: Tue, 20 Feb 2024 18:48:13 +0530 Subject: [PATCH] fix(ui): fixed requested changes and made the badge display on hover --- .../components/ImageGrid/GalleryImage.tsx | 46 +++++++++++-------- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/invokeai/frontend/web/src/features/gallery/components/ImageGrid/GalleryImage.tsx b/invokeai/frontend/web/src/features/gallery/components/ImageGrid/GalleryImage.tsx index 866b3013f2..cf6f285b26 100644 --- a/invokeai/frontend/web/src/features/gallery/components/ImageGrid/GalleryImage.tsx +++ b/invokeai/frontend/web/src/features/gallery/components/ImageGrid/GalleryImage.tsx @@ -1,6 +1,5 @@ -import { Text } from '@chakra-ui/react'; import type { SystemStyleObject } from '@invoke-ai/ui-library'; -import { Box, Flex, useShiftModifier } from '@invoke-ai/ui-library'; +import { Box, Flex, Text, useShiftModifier } from '@invoke-ai/ui-library'; import { useStore } from '@nanostores/react'; import { $customStarUI } from 'app/store/nanostores/customStarUI'; import { useAppDispatch, useAppSelector } from 'app/store/storeHooks'; @@ -23,6 +22,16 @@ const imageIconStyleOverrides: SystemStyleObject = { bottom: 2, top: 'auto', }; +const boxSx: SystemStyleObject = { + containerType: 'inline-size', +}; + +const badgeSx: SystemStyleObject = { + '@container (max-width: 80px)': { + '&': { display: 'none' }, + }, +}; + interface HoverableImageProps { imageName: string; index: number; @@ -122,10 +131,7 @@ const GalleryImage = (props: HoverableImageProps) => { } return ( - + { onMouseOver={handleMouseOver} onMouseOut={handleMouseOut} > - {`${imageDTO.width}x${imageDTO.height}`} <> + {isHovered && ( + {`${imageDTO.width}x${imageDTO.height}`})} {isHovered && shift && (