Feat: I can add a favorite directly from my table (#1747)
* implented add/remove favorite in context menu * clear selected rows after favorite button click, context menu width 200px when remove from favorites is shown * Update front/src/modules/ui/context-menu/components/ContextMenu.tsx
This commit is contained in:
@ -37,7 +37,7 @@ const StyledContainerContextMenu = styled.div<StyledContainerProps>`
|
||||
top: ${(props) => `${props.position.y}px`};
|
||||
|
||||
transform: translateX(-50%);
|
||||
width: 160px;
|
||||
width: auto;
|
||||
z-index: 1;
|
||||
`;
|
||||
|
||||
@ -60,13 +60,20 @@ export const ContextMenu = ({ selectedIds }: OwnProps) => {
|
||||
if (selectedIds.length === 0 || !contextMenuIsOpen) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const width = contextMenuEntries.some(
|
||||
(contextMenuEntry) => contextMenuEntry.label === 'Remove from favorites',
|
||||
)
|
||||
? 200
|
||||
: undefined;
|
||||
|
||||
return (
|
||||
<StyledContainerContextMenu
|
||||
className="context-menu"
|
||||
ref={wrapperRef}
|
||||
position={contextMenuPosition}
|
||||
>
|
||||
<StyledDropdownMenu data-select-disable>
|
||||
<StyledDropdownMenu data-select-disable width={width}>
|
||||
<StyledDropdownMenuItemsContainer>
|
||||
{contextMenuEntries.map((item) => (
|
||||
<ContextMenuItem
|
||||
|
||||
@ -41,6 +41,7 @@ export {
|
||||
IconForbid,
|
||||
IconGripVertical,
|
||||
IconHeart,
|
||||
IconHeartOff,
|
||||
IconHelpCircle,
|
||||
IconInbox,
|
||||
IconLayoutKanban,
|
||||
|
||||
Reference in New Issue
Block a user