@swan-io/lake 8.15.7 → 8.15.9
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.
- package/package.json +1 -1
- package/src/components/Tile.js +16 -18
package/package.json
CHANGED
package/src/components/Tile.js
CHANGED
|
@@ -5,6 +5,7 @@ import { backgroundColor, colors, negativeSpacings, radii, shadows, spacings, te
|
|
|
5
5
|
import { isNotNullish } from "../utils/nullish";
|
|
6
6
|
import { Box } from "./Box";
|
|
7
7
|
import { LakeText } from "./LakeText";
|
|
8
|
+
import { ResponsiveContainer } from "./ResponsiveContainer";
|
|
8
9
|
import { Space } from "./Space";
|
|
9
10
|
const styles = StyleSheet.create({
|
|
10
11
|
container: {
|
|
@@ -97,24 +98,21 @@ export const TileFullWidthContent = ({ children, flexGrow, fitToBottom = false,
|
|
|
97
98
|
};
|
|
98
99
|
const SPACE = _jsx(Space, { height: 24 });
|
|
99
100
|
export const TileGrid = ({ children, breakpoint = 1000 }) => {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
|
-
const isRow = flexDirection === "row";
|
|
117
|
-
return (_jsxs(Box, { direction: flexDirection, onLayout: onLayout, children: [_jsx(View, { style: [isRow && styles.column, isRow && { flexBasis: breakpoint / 2 }], children: leftColumn }), _jsx(Space, { width: 24 }), _jsx(View, { style: [isRow && styles.column, isRow && { flexBasis: breakpoint / 2 }], children: rightColumn })] }));
|
|
101
|
+
return (_jsx(ResponsiveContainer, { breakpoint: breakpoint, children: ({ small, large }) => {
|
|
102
|
+
const childrenArray = Children.toArray(children);
|
|
103
|
+
const leftColumn = [];
|
|
104
|
+
const rightColumn = [];
|
|
105
|
+
const nonNullChildren = childrenArray.filter(isNotNullish);
|
|
106
|
+
nonNullChildren.forEach((item, index) => {
|
|
107
|
+
if (small || index % 2 === 0) {
|
|
108
|
+
leftColumn.push(_jsxs(Fragment, { children: [item, SPACE] }, index));
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
rightColumn.push(_jsxs(Fragment, { children: [item, SPACE] }, index));
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
return (_jsxs(Box, { direction: small ? "column" : "row", children: [_jsx(View, { style: [large && styles.column, large && { flexBasis: breakpoint / 2 }], children: leftColumn }), _jsx(Space, { width: 24 }), _jsx(View, { style: [large && styles.column, large && { flexBasis: breakpoint / 2 }], children: rightColumn })] }));
|
|
115
|
+
} }));
|
|
118
116
|
};
|
|
119
117
|
export const TileRows = ({ children, breakpoint = 1000 }) => {
|
|
120
118
|
const [flexDirection, setFlexDirection] = useState("row");
|