Skip to content
Open
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
23 changes: 23 additions & 0 deletions ts/components/TextStoryCreator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,29 @@ export function TextStoryCreator({
);
}, [isColorPickerShowing, colorPickerPopperRef, colorPickerPopperButtonRef]);

useEffect(() => {
if (!isLinkPreviewInputShowing) {
return noop;
}
return handleOutsideClick(
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this cleanup callback be a function outside of useEffect with useCallback ?
I think that will make this code more readable and cleaner.

() => {
setIsLinkPreviewInputShowing(false);
return true;
},
{
containerElements: [
linkPreviewInputPopperRef,
linkPreviewInputPopperButtonRef,
],
name: 'TextStoryCreator.linkPreviewInput',
}
);
}, [
isLinkPreviewInputShowing,
linkPreviewInputPopperRef,
linkPreviewInputPopperButtonRef,
]);

const sliderColorNumber = getRGBANumber(sliderValue);

let textForegroundColor = sliderColorNumber;
Expand Down