@pagamio/frontend-commons-lib
Version:
Pagamio library for Frontend reusable components like the form engine and table container
25 lines (24 loc) • 1.27 kB
JavaScript
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
import { Button, IconButton } from '../../components';
export const createTableActionsColumn = ({ buttonTitle, icon, label, showIconButton = true, renderContent, handleOnclickButton, }) => {
return {
header: '',
id: 'actions',
accessorKey: 'action',
enableSorting: false,
enableColumnFilter: false,
enableColumnActions: false,
// eslint-disable-next-line @typescript-eslint/naming-convention
Cell: ({ row }) => {
return (_jsx(_Fragment, { children: showIconButton ? (icon &&
handleOnclickButton && (_jsx(IconButton, { className: "font-semibold", icon: icon, label: label, onClick: () => handleOnclickButton(row.original), children: buttonTitle }))) : (_jsx(_Fragment, { children: renderContent ? (renderContent(row.original)) : (_jsx(_Fragment, { children: handleOnclickButton && (_jsx(Button, { className: "font-semibold", onClick: () => handleOnclickButton(row.original), children: buttonTitle })) })) })) }));
},
mantineTableHeadCellProps: () => ({
sx: {
svg: {
display: 'none',
},
},
}),
};
};