feat: marketplaces editor in clients page
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
import React, { CSSProperties, FC } from "react";
|
||||
import React, { CSSProperties, FC, ReactNode } from "react";
|
||||
import { IconDotsVertical, IconEdit, IconTrash } from "@tabler/icons-react";
|
||||
import { Box, Flex, Menu } from "@mantine/core";
|
||||
import ActionIconWithTip from "@/components/ui/ActionIconWithTip/ActionIconWithTip";
|
||||
@ -6,9 +6,17 @@ import DropdownMenuItem from "@/components/ui/DropdownMenuItem/DropdownMenuItem"
|
||||
import ThemeIcon from "@/components/ui/ThemeIcon/ThemeIcon";
|
||||
import useIsMobile from "@/hooks/utils/useIsMobile";
|
||||
|
||||
export type ActionData = {
|
||||
icon: ReactNode;
|
||||
onClick: () => void;
|
||||
label: string;
|
||||
hidden?: boolean;
|
||||
};
|
||||
|
||||
type Props = {
|
||||
onChange: () => void;
|
||||
onDelete: () => void;
|
||||
otherActions?: ActionData[];
|
||||
dotsForMobile?: boolean;
|
||||
style?: CSSProperties;
|
||||
};
|
||||
@ -16,6 +24,7 @@ type Props = {
|
||||
const UpdateDeleteTableActions: FC<Props> = ({
|
||||
onChange,
|
||||
onDelete,
|
||||
otherActions,
|
||||
style,
|
||||
dotsForMobile = false,
|
||||
}) => {
|
||||
@ -37,6 +46,17 @@ const UpdateDeleteTableActions: FC<Props> = ({
|
||||
icon={<IconEdit />}
|
||||
label={"Редактировать"}
|
||||
/>
|
||||
{otherActions?.map(
|
||||
action =>
|
||||
!action.hidden && (
|
||||
<DropdownMenuItem
|
||||
onClick={action.onClick}
|
||||
icon={action.icon}
|
||||
label={action.label}
|
||||
key={action.label}
|
||||
/>
|
||||
)
|
||||
)}
|
||||
<DropdownMenuItem
|
||||
onClick={onDelete}
|
||||
icon={<IconTrash />}
|
||||
@ -59,6 +79,20 @@ const UpdateDeleteTableActions: FC<Props> = ({
|
||||
tipLabel={"Редактировать"}>
|
||||
<IconEdit />
|
||||
</ActionIconWithTip>
|
||||
{otherActions?.map(
|
||||
action =>
|
||||
!action.hidden && (
|
||||
<ActionIconWithTip
|
||||
onClick={e => {
|
||||
e.stopPropagation();
|
||||
action.onClick();
|
||||
}}
|
||||
key={action.label}
|
||||
tipLabel={action.label}>
|
||||
{action.icon}
|
||||
</ActionIconWithTip>
|
||||
)
|
||||
)}
|
||||
<ActionIconWithTip
|
||||
color={"red"}
|
||||
onClick={e => {
|
||||
|
||||
Reference in New Issue
Block a user