diff --git a/src/custom/ResponsiveDataTable.tsx b/src/custom/ResponsiveDataTable.tsx index 8b79738e..b9d8bdd7 100644 --- a/src/custom/ResponsiveDataTable.tsx +++ b/src/custom/ResponsiveDataTable.tsx @@ -1,7 +1,8 @@ -import { Theme, ThemeProvider, createTheme, styled, useTheme } from '@mui/material'; +import { Theme, ThemeProvider, createTheme, styled } from '@mui/material'; import MUIDataTable from 'mui-datatables'; import React, { useCallback } from 'react'; -import { ListItemIcon, ListItemText, Menu, MenuItem } from '../base'; +import { Collapse, ListItemIcon, ListItemText, Menu, MenuItem } from '../base'; +import { ShareIcon } from '../icons'; import { EllipsisIcon } from '../icons/Ellipsis'; import TooltipIcon from './TooltipIcon'; @@ -18,42 +19,73 @@ export const DataTableEllipsisMenu: React.FC<{ actionsList: NonNullable['actionsList']; }> = ({ actionsList }) => { const [anchorEl, setAnchorEl] = React.useState(null); + const [isSocialShareOpen, setIsSocialShareOpen] = React.useState(false); + const handleClick = (event: React.MouseEvent) => { setAnchorEl(event.currentTarget); }; const handleClose = () => { setAnchorEl(null); + setIsSocialShareOpen(false); }; - const theme = useTheme(); + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const handleActionClick = (action: any) => { + if (action.type === 'share-social') { + setIsSocialShareOpen(!isSocialShareOpen); + } else { + if (action.onClick) { + action.onClick(); + } + handleClose(); + } + }; return ( <> } arrow /> - + {actionsList && actionsList.map((action, index) => ( - - - {action.icon} - {action.title} - - + + {action.type === 'share-social' ? ( + <> + handleActionClick(action)} + disabled={action.disabled} + > + + + + {action.title} + + + {action.customComponent} + + + ) : ( + <> + + handleActionClick(action)} + disabled={action.disabled} + > + {action.icon} + {action.title} + + + + )} + ))} @@ -201,6 +233,8 @@ export interface Column { icon: JSX.Element; onClick: () => void; disabled?: boolean; + customComponent?: JSX.Element; + type?: string; }[]; }; }