Skip to content

Commit

Permalink
fix: πŸ› [Table] Primary actions shown as row actions, no sticky
Browse files Browse the repository at this point in the history
βœ… Closes: 289
  • Loading branch information
luciob committed Dec 23, 2022
1 parent 908954b commit 254213d
Showing 1 changed file with 6 additions and 22 deletions.
28 changes: 6 additions & 22 deletions src/components/Table/components/ActionsCell/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { CSSProperties, FC, useMemo } from "react";
import { TableCell as MUITableCell, useTheme } from "@material-ui/core";
import { TableCell as MUITableCell } from "@material-ui/core";

import { IBase } from "../../../../types/Base";
import {
Expand All @@ -25,35 +25,19 @@ const TableActionsCell: FC<ITableActionsCell> = ({
data,
dataCallbackOptions,
dataCy,
position,
style: rowStyle,
}) => {
const theme = useTheme();

const { padding: columnPadding, width } = column;

const padding = useMemo(() => columnPadding || "normal", [columnPadding]);

const style = useMemo((): CSSProperties => {
if (position === "row") {
return {
...rowStyle,
width,
};
}

const backgroundColor = rowStyle?.backgroundColor || theme.palette.background.paper;

return {
const style = useMemo(
(): CSSProperties => ({
...rowStyle,
backgroundColor,
left: 0,
padding: `0 ${theme.spacing(1)}px`,
position: "sticky",
width,
zIndex: 1,
};
}, [position, rowStyle, theme, width]);
}),
[rowStyle, width]
);

const wrapperStyle = useMemo(
(): CSSProperties => ({
Expand Down

0 comments on commit 254213d

Please sign in to comment.