Skip to content

Commit cba2da6

Browse files
committed
feat(Table): update to two prop approach
1 parent 9bb09b6 commit cba2da6

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

packages/react-table/src/components/Table/Table.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ export interface TableProps extends React.HTMLProps<HTMLTableElement>, OUIAProps
5050
role?: string;
5151
/** @beta Flag indicating if the table should have plain styling with a transparent background */
5252
isPlain?: boolean;
53+
/** @beta Flag indicating if the table should not have plain styling when in the glass theme */
54+
isNoPlainOnGlass?: boolean;
5355
/** If set to true, the table header sticks to the top of its container */
5456
isStickyHeader?: boolean;
5557
/** @hide Forwarded ref */
@@ -96,7 +98,8 @@ const TableBase: React.FunctionComponent<TableProps> = ({
9698
variant,
9799
borders = true,
98100
isStickyHeader = false,
99-
isPlain,
101+
isPlain = false,
102+
isNoPlainOnGlass = false,
100103
gridBreakPoint = TableGridBreakpoint.gridMd,
101104
'aria-label': ariaLabel,
102105
role = 'grid',
@@ -226,7 +229,7 @@ const TableBase: React.FunctionComponent<TableProps> = ({
226229
isStriped && styles.modifiers.striped,
227230
isExpandable && styles.modifiers.expandable,
228231
isPlain && styles.modifiers.plain,
229-
isPlain !== undefined && isPlain === false && styles.modifiers.noPlain,
232+
isNoPlainOnGlass && styles.modifiers.noPlain,
230233
hasNoInset && stylesTreeView.modifiers.noInset,
231234
isNested && 'pf-m-nested',
232235
hasAnimations && styles.modifiers.animateExpand

packages/react-table/src/components/Table/__tests__/Table.test.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -169,20 +169,20 @@ test(`Does not render with class ${styles.modifiers.plain} when isPlain is false
169169
expect(screen.getByRole('grid', { name: 'Test table' })).not.toHaveClass(styles.modifiers.plain);
170170
});
171171

172-
test(`Renders with class ${styles.modifiers.noPlain} when isPlain is false`, () => {
173-
render(<Table isPlain={false} aria-label="Test table" />);
172+
test(`Renders with class ${styles.modifiers.noPlain} when isNoPlainOnGlass is true`, () => {
173+
render(<Table isNoPlainOnGlass aria-label="Test table" />);
174174

175175
expect(screen.getByRole('grid', { name: 'Test table' })).toHaveClass(styles.modifiers.noPlain);
176176
});
177177

178-
test(`Does not render with class ${styles.modifiers.noPlain} when isPlain is not defined`, () => {
178+
test(`Does not render with class ${styles.modifiers.noPlain} when isNoPlainOnGlass is undefined`, () => {
179179
render(<Table aria-label="Test table" />);
180180

181181
expect(screen.getByRole('grid', { name: 'Test table' })).not.toHaveClass(styles.modifiers.noPlain);
182182
});
183183

184-
test(`Does not render with class ${styles.modifiers.noPlain} when isPlain is true`, () => {
185-
render(<Table isPlain aria-label="Test table" />);
184+
test(`Does not render with class ${styles.modifiers.noPlain} when isNoPlainOnGlass is false`, () => {
185+
render(<Table isNoPlainOnGlass={false} aria-label="Test table" />);
186186

187187
expect(screen.getByRole('grid', { name: 'Test table' })).not.toHaveClass(styles.modifiers.noPlain);
188188
});

0 commit comments

Comments
 (0)