From 495cf6d22b39d3430b7ba138a7fad0ba5f89a5ff Mon Sep 17 00:00:00 2001 From: Brandon Dow Date: Fri, 10 May 2024 16:15:43 -0400 Subject: [PATCH] fix: Fallback message for virtual table was exceeding table header width --- src/components/Table/GridTable.stories.tsx | 13 ++++++++++++- src/components/Table/GridTable.tsx | 9 +++++---- src/components/Table/utils/utils.tsx | 4 ++++ 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/src/components/Table/GridTable.stories.tsx b/src/components/Table/GridTable.stories.tsx index fa3223995..799d69535 100644 --- a/src/components/Table/GridTable.stories.tsx +++ b/src/components/Table/GridTable.stories.tsx @@ -298,7 +298,17 @@ export function InfiniteScrollWithLoader() { export function NoRowsFallback() { const nameColumn: GridColumn = { header: "Name", data: ({ name }) => name }; const valueColumn: GridColumn = { header: "Value", data: ({ value }) => value }; - return ; + return ( +
+ +
+ ); } // Make a `Row` ADT for a table with a header + 3 levels of nesting @@ -2094,6 +2104,7 @@ export function MinColumnWidths() { = an {/* If virtualized take some pixels off the width to accommodate when virtuoso's scrollbar is introduced. */} {/* Otherwise a horizontal scrollbar will _always_ appear once the vertical scrollbar is needed */} -
+
{renders[_as]( style, id, @@ -713,7 +713,8 @@ function renderVirtual( if (firstRowMessage) { if (index === 0) { return ( -
+ // Ensure the fallback message is the same width as the table +
{firstRowMessage}
); diff --git a/src/components/Table/utils/utils.tsx b/src/components/Table/utils/utils.tsx index b3d3f836f..9d48a2524 100644 --- a/src/components/Table/utils/utils.tsx +++ b/src/components/Table/utils/utils.tsx @@ -301,3 +301,7 @@ export function recursivelyGetContainingRow( return undefined; } + +export function getTableRefWidthStyles(isVirtual: boolean) { + return Css.w100.if(isVirtual).w("calc(100% - 20px)").$; +}