-
Notifications
You must be signed in to change notification settings - Fork 14
/
ActionsCell.tsx
36 lines (34 loc) · 1.08 KB
/
ActionsCell.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import React from "react";
import { ActionIconPropsType } from "./types";
import DxcActionIcon from "../action-icon/ActionIcon";
import { DxcDropdown, DxcFlex, HalstackProvider } from "../main";
import DropdownTheme from "./DropdownTheme";
const DxcActionsCell = ({ actions }: ActionIconPropsType): JSX.Element => {
return (
<DxcFlex gap={"0.5rem"}>
{actions.map((action) =>
action.options?.length ? (
<HalstackProvider advancedTheme={DropdownTheme}>
<DxcDropdown
options={action.options}
onSelectOption={action.onClick}
disabled={action.disabled}
icon={action.icon}
tabIndex={action.tabIndex}
caretHidden
></DxcDropdown>
</HalstackProvider>
) : (
<DxcActionIcon
icon={action.icon}
title={action.title}
onClick={action.onClick}
disabled={action.disabled ?? false}
tabIndex={action.tabIndex ?? 0}
/>
)
)}
</DxcFlex>
);
};
export default DxcActionsCell;