Skip to content

Commit

Permalink
bug: fixes double style in table (#182)
Browse files Browse the repository at this point in the history
  • Loading branch information
saurabhsutar192 authored Oct 13, 2023
1 parent 27a076a commit d8f281f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 2 additions & 0 deletions docs/docs/components/table.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,8 @@ import {
| horizontalSpacing | `string` | `0` | Yes |
| overrideTableClass | `string` | - | Yes |
| overrideTableContainerClass | `string` | - | Yes |
| wrapperStyle | `CSS Style Object` | - | Yes |
| wrapperClassName | `string` | - | Yes |

The table component renders a `div` that wraps the table to not allow the table to overflow the parent, this can be customized by sending a class to `overrideTableContainerClass`

Expand Down
6 changes: 4 additions & 2 deletions packages/react/src/components/Table/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ const Table: ForwardRefRenderFunction<HTMLTableElement, InitialTableProps> = (
children,
className,
style,
wrapperStyle,
wrapperClassName,
horizontalSpacing = "0",
...nativeProps
},
Expand All @@ -50,9 +52,9 @@ const Table: ForwardRefRenderFunction<HTMLTableElement, InitialTableProps> = (

return (
<div
style={{ ...tableContainerInlineVars, ...(style || {}) }}
style={{ ...tableContainerInlineVars, ...(wrapperStyle || {}) }}
className={`${tableContainerDefaults} ${tableContainerThemeClass} ${overrideTableContainerClass} ${
className || ""
wrapperClassName || ""
}`}
>
<table
Expand Down
4 changes: 3 additions & 1 deletion packages/react/src/components/Table/Table.types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from "react";
import React, { CSSProperties } from "react";

export interface InitialTableProps
extends React.DetailedHTMLProps<
Expand All @@ -19,6 +19,8 @@ export interface InitialTableProps
overrideTableClass?: string;
className?: string;
horizontalSpacing?: string;
wrapperStyle?: CSSProperties;
wrapperClassName?: string;
}

export type ITableThemeVars = [
Expand Down

0 comments on commit d8f281f

Please sign in to comment.