RocketChat/Rocket.Chat

View on GitHub
apps/meteor/client/components/GenericTable/GenericTable.tsx

Summary

Maintainability
A
0 mins
Test Coverage
import { Box, Table } from '@rocket.chat/fuselage';
import type { ComponentProps } from 'react';
import React, { type ForwardedRef, type ReactNode, forwardRef } from 'react';

import { CustomScrollbars } from '../CustomScrollbars';

type GenericTableProps = {
    fixed?: boolean;
    children: ReactNode;
} & ComponentProps<typeof Table>;

export const GenericTable = forwardRef(function GenericTable(
    { fixed = true, children, ...props }: GenericTableProps,
    ref: ForwardedRef<HTMLElement>,
) {
    return (
        <Box mi='neg-x24' pi={24} flexShrink={1} flexGrow={1} ref={ref} overflow='hidden'>
            <CustomScrollbars overflowX>
                <Table fixed={fixed} sticky {...props}>
                    {children}
                </Table>
            </CustomScrollbars>
        </Box>
    );
});