diff --git a/gatsby/src/components/MasonryGallery.js b/gatsby/src/components/MasonryGallery.js
index b67edb8..2010625 100644
--- a/gatsby/src/components/MasonryGallery.js
+++ b/gatsby/src/components/MasonryGallery.js
@@ -8,9 +8,9 @@ import resolveConfig from 'tailwindcss/resolveConfig';
import tailwindConfig from '../../tailwind.config.js';
import useBreakpoint from 'use-breakpoint';
-const {theme: {screens}} = resolveConfig(tailwindConfig);
-const themeBreakpoints = R.map(size => parseInt(size, 10), screens);
-console.log(themeBreakpoints);
+const {theme} = resolveConfig(tailwindConfig);
+const themeBreakpoints = R.map(size => parseInt(size, 10), theme.screens);
+console.log(theme);
const MasonryGallery = ({ images, itemsPerRow: itemsPerRowByBreakpoint }) => {
const breakpoints = React.useMemo(() =>
@@ -25,49 +25,49 @@ const MasonryGallery = ({ images, itemsPerRow: itemsPerRowByBreakpoint }) => {
R.map(R.sum)
))(itemsPerRowByBreakpoint), [aspectRatios, itemsPerRowByBreakpoint]);
- // console.log('bp', breakpoint);
+ const itemsPerRow = itemsPerRowByBreakpoint[breakpoint];
const rowAspectRatioSumsForCurrentBP = rowAspectRatioSumsByBreakpoint[breakpoint];
- // console.log('rowAspectRatioSumsForCurrentBP :', rowAspectRatioSumsForCurrentBP);
return (
{images.map((image, i) => {
- const rowIndex = Math.floor(i / itemsPerRowByBreakpoint[breakpoint]);
+ const rowIndex = Math.floor(i / itemsPerRow);
const rowAspectRatioSum = rowAspectRatioSumsForCurrentBP[rowIndex];
- const width = ((getAspectRatio(image) / rowAspectRatioSum) * 100).toFixed(10);
+ // const width = ((getAspectRatio(image) / rowAspectRatioSum) * 100).toFixed(10);
+ const ar = getAspectRatio(image);
+ const widthNumber = ((ar / rowAspectRatioSum) * 100);
+ const gutterReserve = parseInt(theme.spacing['1'], 10) * (itemsPerRow - 1);
+ const width = `${widthNumber}%`;
+ // const width = `${widthNumber}%`;
// console.log('ars', rowAspectRatioSum);
if (i === 0) {
// console.log(rowIndex, rowAspectRatioSum);
- console.log(getName(image), `${width}%`);
+ console.log(getName(image), width);
}
return (
-
- {/* // */}
- {/* // */}
-
+
);
})}
);
diff --git a/gatsby/src/pages/photogallery.js b/gatsby/src/pages/photogallery.js
index 954ccda..d63d29a 100644
--- a/gatsby/src/pages/photogallery.js
+++ b/gatsby/src/pages/photogallery.js
@@ -11,18 +11,6 @@ const GalleryPage = ({ data }) => {
const images = React.useMemo(() =>
data.allFile.edges
.map(edge => edge.node, [data])
- // .sort((left, right) => {
- // const leftDate = new Date(getMeta(left).dateTaken);
- // console.log(leftDate);
- // const rightDate = new Date(getMeta(right).dateTaken);
- // if (leftDate < rightDate) {
- // return 1;
- // }
- // if (leftDate > rightDate) {
- // return -1;
- // }
- // return 0;
- // }) // TODO HERE
, [data]);
return (<>
@@ -32,7 +20,7 @@ const GalleryPage = ({ data }) => {