Rajat Dabade ec3eba612c
[Refactor]: Dynamic Columns PR (#3852)
* fix: remove the space and fix the classname

* refactor: made the dynamicColumnsTable-items responsive

* fix: setcolumndata to a separate function

* fix: handle invalid CreatedOrUpdateTime

* fix: hyphenate classname and bme

* refactor: move the implementation to separate component

* refactor: removed the bydefault render

* refactor: remove render

* refactor: removed unwanted imports

* fix: remove the space and fix the classname

* refactor: made the dynamicColumnsTable-items responsive

* fix: setcolumndata to a separate function

* fix: handle invalid CreatedOrUpdateTime

* fix: hyphenate classname and bme

* refactor: move the implementation to separate component

* refactor: removed the bydefault render

* refactor: remove render

* fix: the classname
2023-11-01 18:26:41 +05:30

31 lines
733 B
TypeScript

import './DropDown.styles.scss';
import { EllipsisOutlined } from '@ant-design/icons';
import { Button, Dropdown, MenuProps } from 'antd';
import { useIsDarkMode } from 'hooks/useDarkMode';
function DropDown({ element }: { element: JSX.Element[] }): JSX.Element {
const isDarkMode = useIsDarkMode();
const items: MenuProps['items'] = element.map(
(e: JSX.Element, index: number) => ({
label: e,
key: index,
}),
);
return (
<Dropdown menu={{ items }}>
<Button
type="link"
className={!isDarkMode ? 'dropdown-button--dark' : 'dropdown-button'}
onClick={(e): void => e.preventDefault()}
>
<EllipsisOutlined className="dropdown-icon" />
</Button>
</Dropdown>
);
}
export default DropDown;