-
Notifications
You must be signed in to change notification settings - Fork 322
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(Table): scroll handlers and menu handlers, fix double scroll (#2564)
- Loading branch information
1 parent
bd382b7
commit 214350b
Showing
16 changed files
with
194 additions
and
199 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
7 changes: 0 additions & 7 deletions
7
packages/core/src/components/Table/Table/TableRoot.module.scss
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
File renamed without changes.
42 changes: 26 additions & 16 deletions
42
packages/core/src/components/Table/TableContainer/TableContainer.tsx
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,23 +1,33 @@ | ||
import React from "react"; | ||
import React, { forwardRef, useRef } from "react"; | ||
import { TableContainerProvider } from "../context/TableContainerContext/TableContainerContext"; | ||
import TableContainerRoot from "./TableContainerRoot"; | ||
import { TableContainerProps } from "./TableContainer.types"; | ||
import { getTestId } from "../../../tests/test-ids-utils"; | ||
import { ComponentDefaultTestId } from "../../../tests/constants"; | ||
import cx from "classnames"; | ||
import styles from "./TableContainer.module.scss"; | ||
|
||
const TableContainer = ({ id, className, "data-testid": dataTestId, style, children }: TableContainerProps) => { | ||
return ( | ||
<TableContainerProvider> | ||
<TableContainerRoot | ||
id={id} | ||
className={className} | ||
data-testid={dataTestId || getTestId(ComponentDefaultTestId.TABLE_CONTAINER, id)} | ||
style={style} | ||
> | ||
{children} | ||
</TableContainerRoot> | ||
</TableContainerProvider> | ||
); | ||
}; | ||
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; |
25 changes: 0 additions & 25 deletions
25
packages/core/src/components/Table/TableContainer/TableContainerRoot.tsx
This file was deleted.
Oops, something went wrong.
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
8 changes: 3 additions & 5 deletions
8
packages/core/src/components/Table/context/TableContainerContext/TableContainerContext.tsx
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
7 changes: 5 additions & 2 deletions
7
...es/core/src/components/Table/context/TableContainerContext/TableContainerContext.types.ts
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,9 +1,12 @@ | ||
import React from "react"; | ||
|
||
export interface ITableContainerContext { | ||
menuContainerRef: React.MutableRefObject<HTMLDivElement>; | ||
export type ITableContainerContext = TableContainerProviderValue; | ||
|
||
export interface TableContainerProviderValue { | ||
menuContainerRef: React.RefObject<HTMLDivElement>; | ||
} | ||
|
||
export interface ITableContainerProviderProps { | ||
value: TableContainerProviderValue; | ||
children: React.ReactNode; | ||
} |
Oops, something went wrong.