Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

[web][photos] Match gallery top and side spacing

Aswin Asok99f85d3511f6
diff --git a/web/apps/photos/src/components/gallery/PhotosNavigationShell.tsx b/web/apps/photos/src/components/gallery/PhotosNavigationShell.tsx
index 81bbf133a4..b0b762bd15 100644
--- a/web/apps/photos/src/components/gallery/PhotosNavigationShell.tsx
+++ b/web/apps/photos/src/components/gallery/PhotosNavigationShell.tsx
@@ -27,6 +27,7 @@ import { NavbarBase } from "ente-base/components/Navbar";
import { useIsSmallWidth } from "ente-base/components/utils/hooks";
import { useModalVisibility } from "ente-base/components/utils/modal";
import { ut } from "ente-base/i18n";
+import { thumbnailGridPadding } from "ente-new/photos/components/utils/thumbnail-grid-layout";
import { isMLSupported } from "ente-new/photos/services/ml";
import { t } from "i18next";
import { useEffect, useState, type ReactNode } from "react";
@@ -206,7 +207,7 @@ export const PhotosNavigationShell: React.FC<
flex: 1,
minWidth: 0,
minHeight: 0,
- pt: showRail ? { xs: 0, sm: "36px" } : 0,
+ pt: showRail ? `${thumbnailGridPadding}px` : 0,
...(showRail && {
"--mui-palette-background-default": "#FFFFFF",
bgcolor: "background.default",
diff --git a/web/packages/new/photos/components/utils/thumbnail-grid-layout.ts b/web/packages/new/photos/components/utils/thumbnail-grid-layout.ts
index 9008cedde5..2d737fe440 100644
--- a/web/packages/new/photos/components/utils/thumbnail-grid-layout.ts
+++ b/web/packages/new/photos/components/utils/thumbnail-grid-layout.ts
@@ -1,4 +1,5 @@
export const thumbnailGap = 4;
+export const thumbnailGridPadding = 24;
const thumbnailMaxHeight = 180;
const thumbnailMaxWidth = 180;
const thumbnailLayoutMinColumns = 4;
@@ -20,7 +21,7 @@ export const computeThumbnailGridLayoutParams = (
containerWidth >
thumbnailLayoutMinColumns * thumbnailMaxWidth
);
- const paddingInline = getGapFromScreenEdge(containerWidth);
+ const paddingInline = thumbnailGridPadding;
const fittableColumns = getFractionFittableColumns(containerWidth);
let columns = Math.floor(fittableColumns);
@@ -45,12 +46,9 @@ export const computeThumbnailGridLayoutParams = (
};
const getFractionFittableColumns = (width: number): number =>
- (width - 2 * getGapFromScreenEdge(width) + thumbnailGap) /
+ (width - 2 * thumbnailGridPadding + thumbnailGap) /
(thumbnailMaxWidth + thumbnailGap);
-const getGapFromScreenEdge = (width: number) =>
- width > thumbnailLayoutMinColumns * thumbnailMaxWidth ? 24 : 4;
-
const getShrinkRatio = (width: number, columns: number) =>
- (width - 2 * getGapFromScreenEdge(width) - (columns - 1) * thumbnailGap) /
+ (width - 2 * thumbnailGridPadding - (columns - 1) * thumbnailGap) /
(columns * thumbnailMaxWidth);