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:
Ayush Agrawal
2023-09-29 22:03:28 +05:30
committed by GitHub
parent ae0acd508a
commit a287a5bc8a
4 changed files with 110 additions and 19 deletions

View File

@ -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

View File

@ -41,6 +41,7 @@ export {
IconForbid,
IconGripVertical,
IconHeart,
IconHeartOff,
IconHelpCircle,
IconInbox,
IconLayoutKanban,