refactor: renamed handler and added comments

This commit is contained in:
peterkwesiansah 2023-06-18 20:13:05 +01:00
parent d2a3a0ce2d
commit 60c66f11f0

View file

@ -33,13 +33,13 @@ const BookmarkButton = ({ currentAddress, pageTitle }: Props) => {
const isPageBookmarked = !!bookmarkFound;
const handleFlyout = () => {
const handleAddRemoveBookmarkOnClick = () => {
if (isPageBookmarked) {
// remove
dispatch(removeBookmark(bookmarkFound));
return;
}
// open flyout
// open flyout to add Bookmark
setOpenFlyout(!openFlyout);
};
@ -50,7 +50,7 @@ const BookmarkButton = ({ currentAddress, pageTitle }: Props) => {
className={cx('rounded-full', {
'text-blue-500': isPageBookmarked,
})}
onClick={handleFlyout}
onClick={handleAddRemoveBookmarkOnClick}
title={`${!isPageBookmarked ? 'Add' : 'Remove'} bookmark`}
>
<Icon