2
0
mirror of https://github.com/inventree/InvenTree.git synced 2026-01-31 10:25:06 +00:00

Refactor more UI components out into lib directory (#9994)

* 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
This commit is contained in:
Oliver
2025-07-10 06:54:53 +10:00
committed by GitHub
parent c6166d7c4a
commit d137728e60
119 changed files with 664 additions and 524 deletions

View File

@@ -0,0 +1,33 @@
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>
);
}