2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-05-01 13:06:45 +00:00
Matthias Mair 782f36cd48
[PUI] Added AboutInventreeModal ()
* updated typing to allow either link or action

* fixed typing

* made it possible to use an action instead of a link

* added ServerInfo Modal skeleton

* fixed anchor

* added content to ServerInfo

* Factored database lookup out

* Extended status API to CUI level

* extended ServerInfo to CUI level

* Made modal larger

* fixed default settings

* Refactored urls into seperate functions

* Refactored python version into seperate function

* Added endpoint and modal for PUI version modal

* switched to indirect imports to reduce imports

* Added copy button

* Added full copy button

* added default

* cleaned unused vars

* cleaned unused  vars

* Refactored auth check for InfoView

* implemented suggested changes

* fixed check logic
2023-10-31 10:02:28 +11:00

36 lines
758 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 = ''
}: {
icon: any;
actions: any[];
label?: string;
tooltip?: string;
}) {
let idx = 0;
return (
<Menu shadow="xs">
<Menu.Target>
<ActionIcon>
<Tooltip label={tooltip}>{icon}</Tooltip>
</ActionIcon>
</Menu.Target>
<Menu.Dropdown>
{label && <Menu.Label>{label}</Menu.Label>}
{actions.map((action) => (
<Menu.Item key={idx++}>{action}</Menu.Item>
))}
</Menu.Dropdown>
</Menu>
);
}