Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: close popover when modal is opened #972

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions frontend/src/components/Board/Card/PopoverSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ const PopoverCardSettings: React.FC<PopoverSettingsProps> = React.memo(
userId,
hideCards,
}) => {
const [openPopover, setOpenPopover] = useState(false);

const { removeFromMergeCard } = useCards();

const unmergeCard = () => {
Expand All @@ -141,8 +143,15 @@ const PopoverCardSettings: React.FC<PopoverSettingsProps> = React.memo(
});
};

const handleOpenPopover = (value: boolean) => setOpenPopover(value);

const handleDelete = () => {
setOpenPopover(false);
if (handleDeleteCard) handleDeleteCard();
};

return (
<Popover>
<Popover open={openPopover} onOpenChange={handleOpenPopover}>
<PopoverTriggerStyled
disabled={hideCards && item.createdBy?._id !== userId}
css={{
Expand All @@ -163,7 +172,7 @@ const PopoverCardSettings: React.FC<PopoverSettingsProps> = React.memo(
<PopoverSettingsContent
isItem={isItem}
isOwner={item.createdBy?._id === userId}
setDeleteCard={handleDeleteCard}
setDeleteCard={handleDelete}
setEditCard={handleEditing}
unmergeCard={unmergeCard}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,11 @@ const OptionsMenu = ({
setOpenPopover(false);
};

const handleOpenPopover = (value: boolean) => setOpenPopover(value);

return (
<>
<Popover open={openPopover} onOpenChange={(value: boolean) => setOpenPopover(value)}>
<Popover open={openPopover} onOpenChange={handleOpenPopover}>
<PopoverTriggerStyled disabled={disabled} css={{ ml: '$8' }}>
<Icon name="menu-dots" size={24} />
</PopoverTriggerStyled>
Expand Down