diff --git a/src/components/MasonryGallery.tsx b/src/components/MasonryGallery.tsx index 2ae73a8..66bb787 100644 --- a/src/components/MasonryGallery.tsx +++ b/src/components/MasonryGallery.tsx @@ -8,7 +8,8 @@ import useBreakpoint from "use-breakpoint"; // @ts-ignore import themeBreakpoints from "../breakpoints"; import classNames from "classnames"; -import { GalleryImage } from "../pages/photogallery"; +import useDimensions from "react-cool-dimensions"; +import { GalleryImage } from "../pages"; interface Row { aspect: number; @@ -17,10 +18,10 @@ interface Row { } interface MasonryGalleryProps { - images: (GalleryImage)[]; + images: GalleryImage[]; aspectsByBreakpoint: { [breakpoint: string]: number; - } + }; debugHue?: boolean; debugRating?: boolean; linkState?: object; @@ -37,8 +38,25 @@ const MasonryGallery = ({ () => R.pick(R.keys(aspectTargetsByBreakpoint), themeBreakpoints), [aspectTargetsByBreakpoint] ); + console.log( + "🚀 ~ file: MasonryGallery.tsx ~ line 41 ~ breakpoints", + breakpoints + ); - const { breakpoint } = useBreakpoint(breakpoints, "sm"); + const { + observe, + width: containerWidth, + currentBreakpoint: breakpoint, + } = useDimensions({ + breakpoints, + }); + // console.log( + // "🚀 ~ file: MasonryGallery.tsx ~ line 47 ~ currentBreakpoint", + // currentBreakpoint + // ); + + // const { breakpoint } = useBreakpoint(breakpoints, "sm"); + console.log("🚀 ~ file: MasonryGallery.tsx ~ line 46 ~ breakpoint", breakpoint) const aspectRatios = React.useMemo( () => R.map(getAspectRatio, images).filter(Boolean), @@ -93,7 +111,8 @@ const MasonryGallery = ({ return ( <>