-
-
Notifications
You must be signed in to change notification settings - Fork 430
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(/lib/components/table): prevent scrollbars around
<Table>
s (#608)
* Update default.ts * Update Table.tsx * Update TableBody.tsx * Update TableCell.tsx * Update TableRow.tsx * Update defaults.ts * Fix prettier errors
- Loading branch information
1 parent
a4f39f5
commit 6f1869b
Showing
5 changed files
with
38 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,25 @@ | ||
import classNames from 'classnames'; | ||
import type { ComponentProps, FC, PropsWithChildren } from 'react'; | ||
import type { DeepPartial } from '..'; | ||
import { mergeDeep } from '../../helpers/mergeDeep'; | ||
import { useTheme } from '../Flowbite'; | ||
import type { FlowbiteTableCellTheme } from './TableCell'; | ||
|
||
export type TableBodyProps = PropsWithChildren<ComponentProps<'tbody'>>; | ||
export interface FlowbiteTableBodyTheme { | ||
base: string; | ||
cell: FlowbiteTableCellTheme; | ||
} | ||
|
||
export const TableBody: FC<TableBodyProps> = ({ children, ...props }) => { | ||
return <tbody {...props}>{children}</tbody>; | ||
export interface TableBodyProps extends PropsWithChildren, ComponentProps<'tbody'> { | ||
theme?: DeepPartial<FlowbiteTableCellTheme>; | ||
} | ||
|
||
export const TableBody: FC<TableBodyProps> = ({ children, className, theme: customTheme = {}, ...props }) => { | ||
const theme = mergeDeep(useTheme().theme.table.body, customTheme); | ||
|
||
return ( | ||
<tbody className={classNames(theme.base, className)} {...props}> | ||
{children} | ||
</tbody> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters