react-justified-layout-ts 2.1.4 → 2.1.5
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.
|
@@ -42,18 +42,17 @@ function JustifiedGrid(props) {
|
|
|
42
42
|
const { targetRowHeightTolerance = .25, width, targetRowHeight = 320, itemSpacing = 8, rowSpacing = 8, children, containerStyle, aspectRatioList } = props;
|
|
43
43
|
const rows = getJustifiedGridRowConfiguration(width, targetRowHeightTolerance, aspectRatioList, targetRowHeight, itemSpacing);
|
|
44
44
|
let childNodeCounter = -1;
|
|
45
|
+
function renderRowItem(value, aspectRatio) {
|
|
46
|
+
childNodeCounter++;
|
|
47
|
+
return react_1.default.createElement("div", { style: Object.assign({ flex: value.length === 1 ? 1 : aspectRatio }, containerStyle) }, children[childNodeCounter]);
|
|
48
|
+
}
|
|
45
49
|
return (react_1.default.createElement("div", { style: {
|
|
46
50
|
display: 'flex',
|
|
47
51
|
flexDirection: 'column',
|
|
48
52
|
gap: rowSpacing
|
|
49
|
-
} }, rows.map(
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
} }, value.map((aspectRatio) => {
|
|
55
|
-
childNodeCounter++;
|
|
56
|
-
return react_1.default.createElement("div", { style: Object.assign({ flex: value.length === 1 ? 1 : aspectRatio }, containerStyle) }, children[childNodeCounter]);
|
|
57
|
-
}));
|
|
58
|
-
})));
|
|
53
|
+
} }, rows.map(value => react_1.default.createElement("div", { className: 'justified-row', style: {
|
|
54
|
+
display: "flex",
|
|
55
|
+
flexDirection: "row",
|
|
56
|
+
gap: itemSpacing,
|
|
57
|
+
} }, value.map(aspectRatio => renderRowItem(value, aspectRatio))))));
|
|
59
58
|
}
|
package/package.json
CHANGED
|
@@ -52,29 +52,28 @@ export function JustifiedGrid(props: Readonly<JustifiedGridProps>) {
|
|
|
52
52
|
const rows = getJustifiedGridRowConfiguration(width, targetRowHeightTolerance, aspectRatioList, targetRowHeight, itemSpacing);
|
|
53
53
|
|
|
54
54
|
let childNodeCounter = -1;
|
|
55
|
+
|
|
56
|
+
function renderRowItem(value: number[], aspectRatio: number) {
|
|
57
|
+
childNodeCounter++;
|
|
58
|
+
return <div style={{flex: value.length === 1 ? 1 : aspectRatio, ...containerStyle}}>
|
|
59
|
+
{children[childNodeCounter]}
|
|
60
|
+
</div>;
|
|
61
|
+
}
|
|
62
|
+
|
|
55
63
|
return (
|
|
56
64
|
<div style={{
|
|
57
65
|
display: 'flex',
|
|
58
66
|
flexDirection: 'column',
|
|
59
67
|
gap: rowSpacing
|
|
60
68
|
}}>
|
|
61
|
-
{rows.map(
|
|
62
|
-
|
|
69
|
+
{rows.map(value =>
|
|
70
|
+
<div className={'justified-row'} style={{
|
|
63
71
|
display: "flex",
|
|
64
72
|
flexDirection: "row",
|
|
65
73
|
gap: itemSpacing,
|
|
66
74
|
}}>
|
|
67
|
-
{value.map(
|
|
68
|
-
|
|
69
|
-
return <div style={{
|
|
70
|
-
flex: value.length === 1 ? 1 : aspectRatio,
|
|
71
|
-
...containerStyle
|
|
72
|
-
}}>
|
|
73
|
-
{children[childNodeCounter]}
|
|
74
|
-
</div>;
|
|
75
|
-
})}
|
|
76
|
-
</div>
|
|
77
|
-
})}
|
|
75
|
+
{value.map(aspectRatio => renderRowItem(value, aspectRatio))}
|
|
76
|
+
</div>)}
|
|
78
77
|
</div>
|
|
79
78
|
);
|
|
80
79
|
}
|