Skip to content

Commit

Permalink
Another approach again
Browse files Browse the repository at this point in the history
  • Loading branch information
chris-cedrone-cengage committed Jan 23, 2025
1 parent f00027f commit 22e7d60
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions packages/react-magma-dom/src/components/Table/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ export const TableContext = React.createContext<TableContextInterface>({
});

export const TableContainer = styled.div<{
minWidth: number;
isInverse?: boolean;
tableOverFlow?: string;
}>`
Expand Down Expand Up @@ -172,8 +171,6 @@ export const Table = React.forwardRef<HTMLTableElement, TableProps>(

const [windowWidth, setWindowWidth] = React.useState(window.innerWidth);

const isBrowser = () => typeof window !== 'undefined';

React.useEffect(() => {
function handleResize() {
setWindowWidth(window.innerWidth);
Expand All @@ -192,8 +189,6 @@ export const Table = React.forwardRef<HTMLTableElement, TableProps>(
return () => window.removeEventListener('resize', handleResize);
}, [windowWidth]);

const handleTableOverFlow = isBrowser && tableOverFlow;

return (
<TableContext.Provider
value={{
Expand All @@ -211,8 +206,7 @@ export const Table = React.forwardRef<HTMLTableElement, TableProps>(
<TableContainer
data-testid={tableWrapper}
isInverse={isInverse}
minWidth={minWidth}
tableOverFlow={handleTableOverFlow}
tableOverFlow={minWidth && tableOverFlow}
theme={theme}
tabIndex={0}
>
Expand Down

0 comments on commit 22e7d60

Please sign in to comment.