123
This commit is contained in:
23
components/Tables/Actions/BaseTableActions.tsx
Normal file
23
components/Tables/Actions/BaseTableActions.tsx
Normal file
@ -0,0 +1,23 @@
|
||||
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;
|
||||
Reference in New Issue
Block a user