Skip to content

Commit

Permalink
fix: props compatibility with table root element
Browse files Browse the repository at this point in the history
  • Loading branch information
abelflopes committed Dec 16, 2024
1 parent 91b97fa commit 7685659
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions packages/components/table/src/Table/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { TFoot } from "../TFoot";
import { Tr } from "../Tr";
import { TableContext, type TableContextProps } from "../context";

type TableProps = React.HTMLAttributes<HTMLDivElement> & Partial<TableContextProps>;
type TableProps = React.HTMLAttributes<HTMLElement> & Partial<TableContextProps>;

/**
* Table is an element that visualizes a data set in rows and columns. It’s often used to embed structured data in a way that’s easy to scan.
Expand All @@ -37,7 +37,6 @@ const Table = ({
<TableContext.Provider value={contextValue}>
{scrollable ? (
<ScrollableContainer
{...otherProps}
className={classNames(
styles.root,
{
Expand All @@ -46,21 +45,24 @@ const Table = ({
},
className,
)}>
<table className={styles.table}>{children}</table>
<table className={styles.table} {...otherProps}>
{children}
</table>
</ScrollableContainer>
) : null}

{!scrollable && (
<div
{...otherProps}
className={classNames(
styles.root,
{
[`${styles[skin]}`]: skin !== "default",
},
className,
)}>
<table className={styles.table}>{children}</table>
<table className={styles.table} {...otherProps}>
{children}
</table>
</div>
)}
</TableContext.Provider>
Expand Down

0 comments on commit 7685659

Please sign in to comment.