Skip to content

Commit

Permalink
Propagate borderless prop from DataTable to Table
Browse files Browse the repository at this point in the history
  • Loading branch information
acelaya committed Nov 8, 2023
1 parent a577d5a commit 83c8ce1
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
9 changes: 8 additions & 1 deletion src/components/data/DataTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ type ComponentProps<Row> = {
/** 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<Row> = CompositeProps &
Expand All @@ -63,6 +66,9 @@ export default function DataTable<Row>({
onConfirmRow,
emptyMessage,

// Forwarded to Table
borderless,

...htmlAttributes
}: DataTableProps<Row>) {
const tableRef = useSyncedRef(elementRef);
Expand Down Expand Up @@ -133,7 +139,8 @@ export default function DataTable<Row>({
title={title}
elementRef={downcastRef(tableRef)}
interactive={!!(onSelectRow || onConfirmRow)}
stickyHeader={true}
stickyHeader
borderless={borderless}
>
<TableHead>
<TableRow>
Expand Down
12 changes: 12 additions & 0 deletions src/pattern-library/components/patterns/data/DataTablePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,18 @@ export default function DataTablePage() {
</Library.Demo>
</Library.Example>

<Library.Example title="borderless">
<Library.Info>
<Library.InfoItem label="description">
See{' '}
<Library.Link href="/data-table#table-props-borderless">
borderless Table
</Library.Link>
.
</Library.InfoItem>
</Library.Info>
</Library.Example>

<Library.Example title="...htmlAttributes">
<Library.Info>
<Library.InfoItem label="description">
Expand Down
2 changes: 1 addition & 1 deletion src/pattern-library/components/patterns/data/TablePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ export default function TablePage() {
</Table>
</Library.Demo>
</Library.Example>
<Library.Example title="borderless">
<Library.Example id="table-props-borderless" title="borderless">
<Library.Info>
<Library.InfoItem label="description">
Set this boolean prop if you want to remove the table{"'"}s
Expand Down

0 comments on commit 83c8ce1

Please sign in to comment.