From e8ab1141605eb83cd77964553f417b0dde589888 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Tue, 7 Nov 2023 16:28:54 +0100 Subject: [PATCH] Propagate borderless prop from DataTable to Table --- src/components/data/DataTable.tsx | 9 ++++++++- .../patterns/data/DataTablePage.tsx | 20 +++++++++++++++++++ .../components/patterns/data/TablePage.tsx | 2 +- 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/src/components/data/DataTable.tsx b/src/components/data/DataTable.tsx index a670a67d9..b68f700ea 100644 --- a/src/components/data/DataTable.tsx +++ b/src/components/data/DataTable.tsx @@ -40,6 +40,9 @@ type ComponentProps = { /** Callback to render an individual table cell */ renderItem?: (r: Row, field: keyof Row) => ComponentChildren; title: string; + + /** Turn off outer table borders */ + borderless?: boolean; }; export type DataTableProps = CompositeProps & @@ -63,6 +66,9 @@ export default function DataTable({ onConfirmRow, emptyMessage, + // Forwarded to Table + borderless, + ...htmlAttributes }: DataTableProps) { const tableRef = useSyncedRef(elementRef); @@ -133,7 +139,8 @@ export default function DataTable({ title={title} elementRef={downcastRef(tableRef)} interactive={!!(onSelectRow || onConfirmRow)} - stickyHeader={true} + stickyHeader + borderless={borderless} > diff --git a/src/pattern-library/components/patterns/data/DataTablePage.tsx b/src/pattern-library/components/patterns/data/DataTablePage.tsx index a53f5c935..1014ee5fe 100644 --- a/src/pattern-library/components/patterns/data/DataTablePage.tsx +++ b/src/pattern-library/components/patterns/data/DataTablePage.tsx @@ -488,6 +488,26 @@ export default function DataTablePage() { + + + + Set this boolean prop if you want to remove the table{"'"}s + outer borders, in case it is rendered in a container with its + own borders. See{' '} + + Borderless Table + + . + + + boolean + + + false + + + + diff --git a/src/pattern-library/components/patterns/data/TablePage.tsx b/src/pattern-library/components/patterns/data/TablePage.tsx index 89318249a..c066fcd1d 100644 --- a/src/pattern-library/components/patterns/data/TablePage.tsx +++ b/src/pattern-library/components/patterns/data/TablePage.tsx @@ -297,7 +297,7 @@ export default function TablePage() { - +
Sushi roll name