diff --git a/app/components/CenteredContent.tsx b/app/components/CenteredContent.tsx index 221e6679bb..ecd8ece872 100644 --- a/app/components/CenteredContent.tsx +++ b/app/components/CenteredContent.tsx @@ -17,7 +17,7 @@ const Container = styled.div` ${breakpoint("tablet")` padding: ${(props: Props) => props.shrink - ? "4px 44px" + ? "0px 44px" : props.withStickyHeader ? "4px 44px 60px" : "60px 44px"}; diff --git a/app/components/Table.tsx b/app/components/Table.tsx index 75cfe03f82..319d1da1b3 100644 --- a/app/components/Table.tsx +++ b/app/components/Table.tsx @@ -24,6 +24,7 @@ import Flex from "~/components/Flex"; import NudeButton from "~/components/NudeButton"; import PlaceholderText from "~/components/PlaceholderText"; import usePrevious from "~/hooks/usePrevious"; +import useWindowSize from "~/hooks/useWindowSize"; type DataColumn = { type: "data"; @@ -66,7 +67,9 @@ function Table({ rowHeight, }: Props) { const { t } = useTranslation(); - const containerRef = React.useRef(null); + const { height } = useWindowSize(); + const [containerHeight, setContainerHeight] = React.useState(0); + const containerRef = React.useRef(null); const columnHelper = React.useMemo(() => createColumnHelper(), []); const observedColumns = React.useMemo( @@ -134,12 +137,18 @@ function Table({ overscan: 5, }); + React.useLayoutEffect(() => { + if (containerRef.current) { + setContainerHeight(height - containerRef.current.offsetTop); + } + }, [height]); + React.useEffect(() => { rowVirtualizer.scrollToOffset?.(0, { behavior: "smooth" }); }, [sortChanged, rowVirtualizer]); return ( - + ` +const Container = styled.div<{ $height: number; $empty: boolean }>` overflow: auto; - height: ${({ $empty }) => !$empty && "max(700px, 70vh)"}; + height: ${({ $height, $empty }) => !$empty && `${$height}px`}; width: 100%; margin-top: 16px; `; diff --git a/app/scenes/Settings/Shares.tsx b/app/scenes/Settings/Shares.tsx index d2691b60d0..e9eccab3b2 100644 --- a/app/scenes/Settings/Shares.tsx +++ b/app/scenes/Settings/Shares.tsx @@ -56,7 +56,7 @@ function Shares() { }, [t, error]); return ( - } wide> + } wide shrink> {t("Shared Links")} {can.update && !canShareDocuments && (