react-justified-layout-ts 2.0.5 → 2.0.6
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.
|
@@ -81,16 +81,10 @@ function TSJustifiedLayout({ children, layoutItems, itemSpacing = 10, rowSpacing
|
|
|
81
81
|
gap: rowSpacing
|
|
82
82
|
} }, rows.map((value, index, array) => {
|
|
83
83
|
let isLastRow = index === array.length - 1 && showWidows;
|
|
84
|
-
let rowTotalAspectRatio = value.items.reduce((previousValue, currentValue) => previousValue + currentValue, 0);
|
|
85
|
-
const isLastRowWithinTolerance = isLastRow && rowTotalAspectRatio *
|
|
86
|
-
const fakeElementAspectRatio = (width - rowTotalAspectRatio - (value.items.length) * itemSpacing) /
|
|
87
|
-
return react_1.default.createElement("div", { className: 'justified-row', style: {
|
|
88
|
-
display: "flex",
|
|
89
|
-
flexDirection: "row",
|
|
90
|
-
gap: itemSpacing,
|
|
91
|
-
} },
|
|
92
|
-
value.items.map((aspectRatio) => renderRowItem(aspectRatio, value.items.length === 1)),
|
|
93
|
-
isLastRowWithinTolerance && react_1.default.createElement("div", { style: { aspectRatio: fakeElementAspectRatio, flex: fakeElementAspectRatio } }));
|
|
84
|
+
// let rowTotalAspectRatio = value.items.reduce((previousValue, currentValue) => previousValue + currentValue, 0);
|
|
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
|
+
return react_1.default.createElement("div", { className: 'justified-row', style: Object.assign({ display: "flex", flexDirection: "row", gap: itemSpacing }, (isLastRow && { aspectRatio: width / value.height })) }, value.items.map((aspectRatio) => renderRowItem(aspectRatio, value.items.length === 1)));
|
|
94
88
|
})));
|
|
95
89
|
}
|
|
96
90
|
exports.TSJustifiedLayout = TSJustifiedLayout;
|
package/package.json
CHANGED
|
@@ -118,17 +118,18 @@ function TSJustifiedLayout({
|
|
|
118
118
|
}}>
|
|
119
119
|
{rows.map((value, index, array) => {
|
|
120
120
|
let isLastRow = index === array.length - 1 && showWidows;
|
|
121
|
-
let rowTotalAspectRatio = value.items.reduce((previousValue, currentValue) => previousValue + currentValue, 0);
|
|
122
|
-
const isLastRowWithinTolerance = isLastRow && rowTotalAspectRatio *
|
|
123
|
-
const fakeElementAspectRatio = (width - rowTotalAspectRatio - (value.items.length) * itemSpacing) /
|
|
121
|
+
// let rowTotalAspectRatio = value.items.reduce((previousValue, currentValue) => previousValue + currentValue, 0);
|
|
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",
|
|
127
127
|
gap: itemSpacing,
|
|
128
|
+
...(isLastRow && {aspectRatio: width / value.height})
|
|
128
129
|
}
|
|
129
130
|
}>
|
|
130
131
|
{value.items.map((aspectRatio) => renderRowItem(aspectRatio, value.items.length === 1))}
|
|
131
|
-
{isLastRowWithinTolerance && <div style={{aspectRatio: fakeElementAspectRatio, flex: fakeElementAspectRatio}}></div>}
|
|
132
|
+
{/*{isLastRowWithinTolerance && <div style={{aspectRatio: fakeElementAspectRatio, flex: fakeElementAspectRatio}}></div>}*/}
|
|
132
133
|
</div>
|
|
133
134
|
})}
|
|
134
135
|
</div>
|