mirror of
https://github.com/inventree/InvenTree.git
synced 2026-01-30 18:13:49 +00:00
* Refactor table column types * Offloading more component type definitions * Remove unused funcs * Move conversion functions * ActionButton * Refactor YesNoButton * ProgressBar * make row actions available * search input * ButtonMenu * Bump UI version * Tweak function defs
34 lines
796 B
TypeScript
34 lines
796 B
TypeScript
import { ActionIcon, Menu, Tooltip } from '@mantine/core';
|
|
|
|
/**
|
|
* A ButtonMenu is a button that opens a menu when clicked.
|
|
* It features a number of actions, which can be selected by the user.
|
|
*/
|
|
export function ButtonMenu({
|
|
icon,
|
|
actions,
|
|
tooltip = '',
|
|
label = ''
|
|
}: Readonly<{
|
|
icon: any;
|
|
actions: React.ReactNode[];
|
|
label?: string;
|
|
tooltip?: string;
|
|
}>) {
|
|
return (
|
|
<Menu shadow='xs'>
|
|
<Menu.Target>
|
|
<ActionIcon variant='default'>
|
|
<Tooltip label={tooltip}>{icon}</Tooltip>
|
|
</ActionIcon>
|
|
</Menu.Target>
|
|
<Menu.Dropdown>
|
|
{label && <Menu.Label>{label}</Menu.Label>}
|
|
{actions.map((action, i) => (
|
|
<Menu.Item key={`${i}-${action}`}>{action}</Menu.Item>
|
|
))}
|
|
</Menu.Dropdown>
|
|
</Menu>
|
|
);
|
|
}
|