diff --git a/src/components/GalleryImage/GalleryImage.js b/src/components/GalleryImage/GalleryImage.js index 0448b15..8958ee7 100644 --- a/src/components/GalleryImage/GalleryImage.js +++ b/src/components/GalleryImage/GalleryImage.js @@ -226,13 +226,13 @@ const GalleryImage = ({ data, location: { state } }) => {
-
+

{image.base}

@@ -256,7 +256,15 @@ const GalleryImage = ({ data, location: { state } }) => { > Download wallpaper -
+
+
+
+
+
+
+
+
+
{
R.map(getAspectRatio, images).filter(Boolean), @@ -122,7 +124,7 @@ const MasonryGallery = ({ const rowAspectRatioSum = currentRow.aspect; const ar = getAspectRatio(image); let width; - let height = `calc(${galleryWidth} / ${rowAspectRatioSum} - 10px)`; + let height = `calc(${galleryWidth} / ${rowAspectRatioSum} + 10px)`; if (rowAspectRatioSum < targetAspect * 0.66) { // incomplete row, render stuff at "ideal" sizes instead of filling width width = `calc(calc(100vw - 160px) / ${targetAspect / ar})`; @@ -136,8 +138,7 @@ const MasonryGallery = ({ return ( - {debugHue && ( - - hsl( - {image.fields?.imageMeta?.dominantHue?.[0]},{" "} - {(image.fields?.imageMeta?.dominantHue?.[1] ?? 0 * 100).toFixed( - 2 - )} - %,{" "} - {(image.fields?.imageMeta?.dominantHue?.[2] ?? 0 * 100).toFixed( - 2 - )} - % ) - - )} {debugRating && ( rating: {image.fields?.imageMeta?.meta?.Rating} )} {img && ( - + + )} ); diff --git a/src/utils.ts b/src/utils.ts index cd292c9..d8880d7 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -24,17 +24,19 @@ export const getCanonicalSize = (image: GalleryImage) => ({ export const getRgba = (palette: string[], alpha: number) => `rgba(${palette[0]}, ${palette[1]}, ${palette[2]}, ${alpha || 1})`; +export const getVibrantStyle = (vibrant: Queries.FileFieldsImageMetaVibrant, screenHeight?: number) => ({ + "--muted": vibrant.Muted, + "--dark-muted": vibrant.DarkMuted, + "--light-muted": vibrant.LightMuted, + "--vibrant": vibrant.Vibrant, + "--dark-vibrant": vibrant.DarkVibrant, + "--light-vibrant": vibrant.LightVibrant, + "--height-screen": screenHeight ? `${screenHeight}px` : "100vh", +}); + // work around SSR bug in react-helmet export const getHelmetSafeBodyStyle = (vibrant: Queries.FileFieldsImageMetaVibrant, screenHeight?: number) => { - const style = { - "--muted": vibrant.Muted, - "--dark-muted": vibrant.DarkMuted, - "--light-muted": vibrant.LightMuted, - "--vibrant": vibrant.Vibrant, - "--dark-vibrant": vibrant.DarkVibrant, - "--light-vibrant": vibrant.LightVibrant, - "--height-screen": screenHeight ? `${screenHeight}px` : "100vh", - }; + const style = getVibrantStyle(vibrant, screenHeight); if (typeof window === "undefined") { return style; }