Files
grungnet/src/components/tile/TilesContainer.js

58 lines
1.3 KiB
JavaScript
Raw Normal View History

import React from "react";
import { Grid, useThemeUI } from "theme-ui";
import SimpleBar from "simplebar-react";
2021-05-24 17:11:46 +10:00
import { useGroup } from "../../contexts/GroupContext";
import { ADD_TO_MAP_ID } from "../../contexts/TileDragContext";
2021-05-24 17:11:46 +10:00
import useResponsiveLayout from "../../hooks/useResponsiveLayout";
import Droppable from "../drag/Droppable";
function TilesContainer({ children }) {
2021-05-24 17:11:46 +10:00
const { onGroupSelect } = useGroup();
const { theme } = useThemeUI();
const layout = useResponsiveLayout();
return (
<>
<SimpleBar
style={{
height: layout.tileContainerHeight,
backgroundColor: theme.colors.muted,
2021-05-24 17:11:46 +10:00
}}
onClick={() => onGroupSelect()}
>
<Grid
p={3}
pb={4}
sx={{
borderRadius: "4px",
overflow: "hidden",
position: "relative",
}}
gap={2}
columns={`repeat(${layout.tileGridColumns}, 1fr)`}
>
<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,
zIndex: -1,
}}
/>
{children}
</Grid>
</SimpleBar>
</>
);
}
export default TilesContainer;