2024-06-13 08:44:38 -04:00
|
|
|
import { Table as BS5Table } from 'react-bootstrap-5'
|
|
|
|
import classnames from 'classnames'
|
|
|
|
|
2024-07-10 09:34:19 -04:00
|
|
|
export function TableContainer({
|
|
|
|
responsive,
|
|
|
|
bordered,
|
|
|
|
children,
|
|
|
|
}: React.ComponentProps<typeof BS5Table>) {
|
|
|
|
return (
|
2024-06-13 08:44:38 -04:00
|
|
|
<div
|
|
|
|
className={classnames('table-container', {
|
2024-07-10 09:34:19 -04:00
|
|
|
'table-container-bordered': bordered,
|
|
|
|
'table-responsive': responsive,
|
2024-06-13 08:44:38 -04:00
|
|
|
})}
|
|
|
|
>
|
2024-07-10 09:34:19 -04:00
|
|
|
{children}
|
2024-06-13 08:44:38 -04:00
|
|
|
</div>
|
|
|
|
)
|
2024-07-10 09:34:19 -04:00
|
|
|
}
|
2024-06-13 08:44:38 -04:00
|
|
|
|
2024-07-10 09:34:19 -04:00
|
|
|
type TableProps = React.ComponentProps<typeof BS5Table> & {
|
|
|
|
container?: boolean
|
|
|
|
}
|
2024-06-13 08:44:38 -04:00
|
|
|
|
2024-07-10 09:34:19 -04:00
|
|
|
function Table({
|
|
|
|
container = true,
|
|
|
|
responsive,
|
|
|
|
bordered,
|
|
|
|
...rest
|
|
|
|
}: TableProps) {
|
|
|
|
return container ? (
|
|
|
|
<TableContainer responsive={responsive} bordered={bordered}>
|
|
|
|
<BS5Table {...rest} />
|
|
|
|
</TableContainer>
|
|
|
|
) : (
|
|
|
|
<BS5Table {...rest} />
|
|
|
|
)
|
2024-06-13 08:44:38 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
export default Table
|