-
Notifications
You must be signed in to change notification settings - Fork 359
Expand file tree
/
Copy pathTableContainer.tsx
More file actions
33 lines (29 loc) · 1.07 KB
/
TableContainer.tsx
File metadata and controls
33 lines (29 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import React, { forwardRef, useRef } from "react";
import { TableContainerProvider } from "../context/TableContainerContext/TableContainerContext";
import { type TableContainerProps } from "./TableContainer.types";
import { getTestId, ComponentDefaultTestId } from "@vibe/shared";
import cx from "classnames";
import styles from "./TableContainer.module.scss";
const TableContainer = forwardRef(
(
{ id, className, "data-testid": dataTestId, style, children }: TableContainerProps,
ref: React.ForwardedRef<HTMLDivElement>
) => {
const menuContainerRef = useRef<HTMLDivElement>(null);
return (
<TableContainerProvider value={{ menuContainerRef }}>
<div
ref={ref}
id={id}
className={cx(styles.tableContainer, className)}
data-testid={dataTestId || getTestId(ComponentDefaultTestId.TABLE_CONTAINER, id)}
style={style}
>
<div ref={menuContainerRef} className={styles.menuContainer} />
{children}
</div>
</TableContainerProvider>
);
}
);
export default TableContainer;