From bcdc7a345c9835e1122f91c97bfc2096a08c8703 Mon Sep 17 00:00:00 2001 From: Chris Date: Mon, 20 Feb 2023 10:02:11 -0600 Subject: [PATCH] Add ability to select obs preview image (#491) * Add ability to select obs preview image * Use Inat icon * lint * Make icon smaller * Change icon dimensions * Add border radius to theme * Add ability to select obs preview image * Use Inat icon * lint * Make icon smaller * Remove empty lines * Update UiLibrary.js * Update UiLibrary.js --------- Co-authored-by: Johannes Klein --- src/components/Observations/ObsGridItem.js | 3 +- src/components/Observations/ObsListItem.js | 6 ++- .../Observations/ObsPreviewImage/index.js | 50 +++++++++++++++---- tailwind.config.js | 3 +- 4 files changed, 49 insertions(+), 13 deletions(-) diff --git a/src/components/Observations/ObsGridItem.js b/src/components/Observations/ObsGridItem.js index 73ebe15a3..860c8f35d 100644 --- a/src/components/Observations/ObsGridItem.js +++ b/src/components/Observations/ObsGridItem.js @@ -41,7 +41,8 @@ const ObsGridItem = ( { source={imageSource} height="h-[172px]" width="w-full" - observation={observation} + obsPhotosCount={observation?.observationPhotos?.length ?? 0} + hasSound={!!observation?.observationSounds?.length} isMultiplePhotosTop > diff --git a/src/components/Observations/ObsListItem.js b/src/components/Observations/ObsListItem.js index 6fcdec3ee..ec120d4a9 100644 --- a/src/components/Observations/ObsListItem.js +++ b/src/components/Observations/ObsListItem.js @@ -25,11 +25,13 @@ const ObsListItem = ( { observation }: Props ): Node => { > - + { const theme = useTheme( ); - const obsPhotosCount = observation?.observationPhotos?.length ?? 0; const hasMultiplePhotos = obsPhotosCount > 1; - const hasSound = !!observation?.observationSounds?.length; const filterIconName = obsPhotosCount > 9 ? "filter-9-plus" : `filter-${obsPhotosCount || 2}`; + const borderRadius = hasSmallBorderRadius ? "rounded-lg" : "rounded-2xl"; return ( + {selectable && ( + + {selected && ( + + )} + + )} {hasMultiplePhotos && (