24 lines
690 B
TypeScript
24 lines
690 B
TypeScript
import { IconPencil, IconTrash } from '@tabler/icons-react';
|
|
import { ActionIcon, Flex, rem } from '@mantine/core';
|
|
|
|
type Props<T> = {
|
|
element: T;
|
|
onChange: (element: T) => Promise<void>;
|
|
onDelete: (element: T) => Promise<void>;
|
|
};
|
|
|
|
const BaseTableActions = <T,>({ element, onChange, onDelete }: Props<T>) => {
|
|
return (
|
|
<Flex gap={rem(10)} align="center" justify="center">
|
|
<ActionIcon variant="default" onClick={async () => await onChange(element)}>
|
|
<IconPencil />
|
|
</ActionIcon>
|
|
<ActionIcon variant="default" onClick={async () => await onDelete(element)}>
|
|
<IconTrash />
|
|
</ActionIcon>
|
|
</Flex>
|
|
);
|
|
};
|
|
|
|
export default BaseTableActions;
|