From 704df818f127f4c9283b6f650d0c20dfcb684415 Mon Sep 17 00:00:00 2001 From: Sam Becker Date: Thu, 13 Mar 2025 23:25:54 -0500 Subject: [PATCH] Enhancements for non-fixed aspect ratios --- src/components/index.ts | 9 +++++++++ src/photo/PhotoGrid.tsx | 6 ++++-- src/photo/PhotoGridContainer.tsx | 3 ++- src/photo/PhotoHeader.tsx | 7 +++++-- 4 files changed, 20 insertions(+), 5 deletions(-) create mode 100644 src/components/index.ts diff --git a/src/components/index.ts b/src/components/index.ts new file mode 100644 index 00000000..d0b0465f --- /dev/null +++ b/src/components/index.ts @@ -0,0 +1,9 @@ +import { GRID_ASPECT_RATIO } from '@/app/config'; + +export const GRID_GAP_CLASSNAME = GRID_ASPECT_RATIO === 0 + ? 'gap-1 sm:gap-2' + : 'gap-0.5 sm:gap-1'; + +export const GRID_SPACE_CLASSNAME = GRID_ASPECT_RATIO === 0 + ? 'space-y-1 sm:space-y-2' + : 'space-y-0.5 sm:space-y-1'; diff --git a/src/photo/PhotoGrid.tsx b/src/photo/PhotoGrid.tsx index 64f9c8a9..117bfc1d 100644 --- a/src/photo/PhotoGrid.tsx +++ b/src/photo/PhotoGrid.tsx @@ -9,6 +9,7 @@ import { GRID_ASPECT_RATIO } from '@/app/config'; import { useAppState } from '@/state/AppState'; import SelectTileOverlay from '@/components/SelectTileOverlay'; import { ReactNode } from 'react'; +import { GRID_GAP_CLASSNAME } from '@/components'; export default function PhotoGrid({ photos, @@ -54,7 +55,8 @@ export default function PhotoGrid({ return ( } -
+
{start === end ? start - : <>{end}
– {start}} + : <>{end}
– {start}} ; const renderContentA = () => entity ?? ( @@ -96,7 +97,9 @@ export default function PhotoHeader({ items={[