react-justified-layout-ts 2.0.5 → 2.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -82,8 +82,8 @@ function TSJustifiedLayout({ children, layoutItems, itemSpacing = 10, rowSpacing
82
82
  } }, rows.map((value, index, array) => {
83
83
  let isLastRow = index === array.length - 1 && showWidows;
84
84
  let rowTotalAspectRatio = value.items.reduce((previousValue, currentValue) => previousValue + currentValue, 0);
85
- const isLastRowWithinTolerance = isLastRow && rowTotalAspectRatio * targetRowHeight + (value.items.length - 1) * itemSpacing < minAspectRatio * targetRowHeight;
86
- const fakeElementAspectRatio = (width - rowTotalAspectRatio - (value.items.length) * itemSpacing) / targetRowHeight;
85
+ const isLastRowWithinTolerance = isLastRow && rowTotalAspectRatio * value.height + (value.items.length - 1) * itemSpacing < minAspectRatio * value.height;
86
+ const fakeElementAspectRatio = (width - rowTotalAspectRatio - (value.items.length) * itemSpacing) / value.height;
87
87
  return react_1.default.createElement("div", { className: 'justified-row', style: {
88
88
  display: "flex",
89
89
  flexDirection: "row",
@@ -1,3 +1,4 @@
1
1
  .justified-row img {
2
- width: 100%
2
+ width: 100%;
3
+ display: block;
3
4
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-justified-layout-ts",
3
- "version": "2.0.5",
3
+ "version": "2.0.7",
4
4
  "description": "A component based off Flickr's justified layout that is compatible with Typescript",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -119,8 +119,8 @@ function TSJustifiedLayout({
119
119
  {rows.map((value, index, array) => {
120
120
  let isLastRow = index === array.length - 1 && showWidows;
121
121
  let rowTotalAspectRatio = value.items.reduce((previousValue, currentValue) => previousValue + currentValue, 0);
122
- const isLastRowWithinTolerance = isLastRow && rowTotalAspectRatio * targetRowHeight + (value.items.length - 1) * itemSpacing < minAspectRatio * targetRowHeight;
123
- const fakeElementAspectRatio = (width - rowTotalAspectRatio - (value.items.length) * itemSpacing) / targetRowHeight
122
+ const isLastRowWithinTolerance = isLastRow && rowTotalAspectRatio * value.height + (value.items.length - 1) * itemSpacing < minAspectRatio * value.height;
123
+ const fakeElementAspectRatio = (width - rowTotalAspectRatio - (value.items.length) * itemSpacing) / value.height
124
124
  return <div className={'justified-row'} style={{
125
125
  display: "flex",
126
126
  flexDirection: "row",
@@ -1,3 +1,4 @@
1
1
  .justified-row img {
2
- width: 100%
2
+ width: 100%;
3
+ display: block;
3
4
  }