2021-05-24 13:34:21 +10:00
|
|
|
import React from "react";
|
2021-05-27 17:37:59 +10:00
|
|
|
import { Grid, useThemeUI } from "theme-ui";
|
2021-05-24 13:34:21 +10:00
|
|
|
import SimpleBar from "simplebar-react";
|
|
|
|
|
|
2021-05-24 17:11:46 +10:00
|
|
|
import { useGroup } from "../../contexts/GroupContext";
|
2021-06-08 23:46:20 +10:00
|
|
|
import { ADD_TO_MAP_ID } from "../../contexts/TileDragContext";
|
2021-05-24 17:11:46 +10:00
|
|
|
|
2021-05-24 13:34:21 +10:00
|
|
|
import useResponsiveLayout from "../../hooks/useResponsiveLayout";
|
|
|
|
|
|
2021-06-08 23:46:20 +10:00
|
|
|
import Droppable from "../drag/Droppable";
|
|
|
|
|
|
2021-05-27 17:19:36 +10:00
|
|
|
function TilesContainer({ children }) {
|
2021-05-24 17:11:46 +10:00
|
|
|
const { onGroupSelect } = useGroup();
|
|
|
|
|
|
2021-05-27 17:37:59 +10:00
|
|
|
const { theme } = useThemeUI();
|
|
|
|
|
|
2021-05-24 13:34:21 +10:00
|
|
|
const layout = useResponsiveLayout();
|
|
|
|
|
|
|
|
|
|
return (
|
2021-05-27 17:37:59 +10:00
|
|
|
<>
|
|
|
|
|
<SimpleBar
|
|
|
|
|
style={{
|
|
|
|
|
height: layout.tileContainerHeight,
|
|
|
|
|
backgroundColor: theme.colors.muted,
|
2021-05-24 17:11:46 +10:00
|
|
|
}}
|
|
|
|
|
onClick={() => onGroupSelect()}
|
|
|
|
|
>
|
2021-05-27 17:37:59 +10:00
|
|
|
<Grid
|
|
|
|
|
p={3}
|
|
|
|
|
pb={4}
|
|
|
|
|
sx={{
|
|
|
|
|
borderRadius: "4px",
|
|
|
|
|
overflow: "hidden",
|
2021-06-08 23:46:20 +10:00
|
|
|
position: "relative",
|
2021-05-27 17:37:59 +10:00
|
|
|
}}
|
|
|
|
|
gap={2}
|
|
|
|
|
columns={`repeat(${layout.tileGridColumns}, 1fr)`}
|
|
|
|
|
>
|
2021-06-08 23:46:20 +10:00
|
|
|
<Droppable
|
|
|
|
|
id={ADD_TO_MAP_ID}
|
|
|
|
|
style={{
|
|
|
|
|
position: "absolute",
|
2021-06-09 23:24:24 +10:00
|
|
|
top: 0,
|
|
|
|
|
bottom: 0,
|
|
|
|
|
left: 0,
|
|
|
|
|
right: 0,
|
2021-06-08 23:46:20 +10:00
|
|
|
zIndex: -1,
|
|
|
|
|
}}
|
|
|
|
|
/>
|
2021-05-27 17:37:59 +10:00
|
|
|
{children}
|
|
|
|
|
</Grid>
|
|
|
|
|
</SimpleBar>
|
|
|
|
|
</>
|
2021-05-24 13:34:21 +10:00
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default TilesContainer;
|