Move tile container background to stay with scrolled content
This commit is contained in:
parent
69eafb868c
commit
456f91c9ae
@ -1,5 +1,5 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { Box, Grid } from "theme-ui";
|
import { Grid, useThemeUI } from "theme-ui";
|
||||||
import SimpleBar from "simplebar-react";
|
import SimpleBar from "simplebar-react";
|
||||||
|
|
||||||
import { useGroup } from "../../contexts/GroupContext";
|
import { useGroup } from "../../contexts/GroupContext";
|
||||||
@ -9,33 +9,33 @@ import useResponsiveLayout from "../../hooks/useResponsiveLayout";
|
|||||||
function TilesContainer({ children }) {
|
function TilesContainer({ children }) {
|
||||||
const { onGroupSelect } = useGroup();
|
const { onGroupSelect } = useGroup();
|
||||||
|
|
||||||
|
const { theme } = useThemeUI();
|
||||||
|
|
||||||
const layout = useResponsiveLayout();
|
const layout = useResponsiveLayout();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SimpleBar style={{ height: layout.tileContainerHeight }}>
|
<>
|
||||||
<Box
|
<SimpleBar
|
||||||
sx={{
|
style={{
|
||||||
position: "absolute",
|
height: layout.tileContainerHeight,
|
||||||
width: "100%",
|
backgroundColor: theme.colors.muted,
|
||||||
height: "100%",
|
|
||||||
top: 0,
|
|
||||||
}}
|
}}
|
||||||
bg="muted"
|
|
||||||
onClick={() => onGroupSelect()}
|
onClick={() => onGroupSelect()}
|
||||||
/>
|
|
||||||
<Grid
|
|
||||||
p={3}
|
|
||||||
pb={4}
|
|
||||||
sx={{
|
|
||||||
borderRadius: "4px",
|
|
||||||
overflow: "hidden",
|
|
||||||
}}
|
|
||||||
gap={2}
|
|
||||||
columns={`repeat(${layout.tileGridColumns}, 1fr)`}
|
|
||||||
>
|
>
|
||||||
{children}
|
<Grid
|
||||||
</Grid>
|
p={3}
|
||||||
</SimpleBar>
|
pb={4}
|
||||||
|
sx={{
|
||||||
|
borderRadius: "4px",
|
||||||
|
overflow: "hidden",
|
||||||
|
}}
|
||||||
|
gap={2}
|
||||||
|
columns={`repeat(${layout.tileGridColumns}, 1fr)`}
|
||||||
|
>
|
||||||
|
{children}
|
||||||
|
</Grid>
|
||||||
|
</SimpleBar>
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { Box, Close, Grid } from "theme-ui";
|
import { Box, Close, Grid, useThemeUI } from "theme-ui";
|
||||||
import { useSpring, animated, config } from "react-spring";
|
import { useSpring, animated, config } from "react-spring";
|
||||||
import ReactResizeDetector from "react-resize-detector";
|
import ReactResizeDetector from "react-resize-detector";
|
||||||
import SimpleBar from "simplebar-react";
|
import SimpleBar from "simplebar-react";
|
||||||
@ -11,6 +11,8 @@ import useResponsiveLayout from "../../hooks/useResponsiveLayout";
|
|||||||
function TilesOverlay({ children }) {
|
function TilesOverlay({ children }) {
|
||||||
const { openGroupId, onGroupClose, onGroupSelect } = useGroup();
|
const { openGroupId, onGroupClose, onGroupSelect } = useGroup();
|
||||||
|
|
||||||
|
const { theme } = useThemeUI();
|
||||||
|
|
||||||
const layout = useResponsiveLayout();
|
const layout = useResponsiveLayout();
|
||||||
|
|
||||||
const openAnimation = useSpring({
|
const openAnimation = useSpring({
|
||||||
@ -63,28 +65,21 @@ function TilesOverlay({ children }) {
|
|||||||
borderColor: "border",
|
borderColor: "border",
|
||||||
cursor: "default",
|
cursor: "default",
|
||||||
display: "flex",
|
display: "flex",
|
||||||
alignItems: "center",
|
alignItems: "flex-end",
|
||||||
justifyContent: "center",
|
justifyContent: "center",
|
||||||
position: "relative",
|
position: "relative",
|
||||||
}}
|
}}
|
||||||
bg="background"
|
bg="background"
|
||||||
onClick={(e) => e.stopPropagation()}
|
onClick={(e) => e.stopPropagation()}
|
||||||
>
|
>
|
||||||
<Box
|
|
||||||
sx={{
|
|
||||||
position: "absolute",
|
|
||||||
width: "100%",
|
|
||||||
height: "100%",
|
|
||||||
top: 0,
|
|
||||||
}}
|
|
||||||
bg="muted"
|
|
||||||
onClick={() => onGroupSelect()}
|
|
||||||
/>
|
|
||||||
<SimpleBar
|
<SimpleBar
|
||||||
style={{
|
style={{
|
||||||
width: containerSize - 16,
|
width: containerSize - 16,
|
||||||
height: containerSize - 48,
|
height: containerSize - 48,
|
||||||
|
marginBottom: "8px",
|
||||||
|
backgroundColor: theme.colors.muted,
|
||||||
}}
|
}}
|
||||||
|
onClick={() => onGroupSelect()}
|
||||||
>
|
>
|
||||||
<Grid
|
<Grid
|
||||||
sx={{
|
sx={{
|
||||||
@ -93,7 +88,7 @@ function TilesOverlay({ children }) {
|
|||||||
}}
|
}}
|
||||||
gap={2}
|
gap={2}
|
||||||
columns={`repeat(${layout.groupGridColumns}, 1fr)`}
|
columns={`repeat(${layout.groupGridColumns}, 1fr)`}
|
||||||
px={3}
|
p={3}
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
</Grid>
|
</Grid>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user