2022-09-06 01:51:57 +00:00
|
|
|
import { theme } from "app/client/ui2018/cssVars";
|
2021-06-28 18:02:45 +00:00
|
|
|
import { icon } from "app/client/ui2018/icons";
|
2022-09-06 01:51:57 +00:00
|
|
|
import { dom, DomArg, IDisposableOwner, styled } from "grainjs";
|
2021-06-28 18:02:45 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Creates a toggle button - little square button with a dropdown icon inside, used
|
|
|
|
* by a context menu for a row inside a grid, a card inside a cardlist and column name.
|
|
|
|
*/
|
|
|
|
export function menuToggle(obs: IDisposableOwner, ...args: DomArg[]) {
|
|
|
|
const contextMenu = cssMenuToggle(
|
|
|
|
icon('Dropdown', dom.cls('menu_toggle_icon')),
|
|
|
|
...args
|
|
|
|
);
|
|
|
|
return contextMenu;
|
|
|
|
}
|
|
|
|
|
|
|
|
const cssMenuToggle = styled('div.menu_toggle', `
|
2022-09-06 01:51:57 +00:00
|
|
|
background: ${theme.menuToggleBg};
|
2021-06-28 18:02:45 +00:00
|
|
|
cursor: pointer;
|
2022-09-06 01:51:57 +00:00
|
|
|
--icon-color: ${theme.menuToggleFg};
|
|
|
|
border: 1px solid ${theme.menuToggleBorder};
|
2021-06-28 18:02:45 +00:00
|
|
|
border-radius: 4px;
|
|
|
|
&:hover {
|
2022-09-06 01:51:57 +00:00
|
|
|
--icon-color: ${theme.menuToggleHoverFg};
|
|
|
|
border-color: ${theme.menuToggleHoverFg};
|
2021-06-28 18:02:45 +00:00
|
|
|
}
|
|
|
|
&:active {
|
2022-09-06 01:51:57 +00:00
|
|
|
--icon-color: ${theme.menuToggleActiveFg};
|
|
|
|
border-color: ${theme.menuToggleActiveFg};
|
2021-06-28 18:02:45 +00:00
|
|
|
}
|
|
|
|
& > .menu_toggle_icon {
|
|
|
|
display: block; /* don't create a line */
|
|
|
|
}
|
|
|
|
`);
|