Skip to content

Commit

Permalink
fix: Improved the user experience of the highlights input form (#1362)
Browse files Browse the repository at this point in the history
Co-authored-by: Deepak Paul <rudra.ad7@gmail.com>
  • Loading branch information
deepakrudrapaul and Deepak Paul authored Jul 18, 2023
1 parent 36a6216 commit 2425dc4
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion components/molecules/HighlightInput/highlight-input-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,20 @@ const HighlightInputForm = ({ refreshCallback }: HighlightInputFormProps): JSX.E
}
};


// Handle collapsible change
const handleCollapsibleOpenChange = () => {
if(isDivFocused && !charCount) {
setIsDivFocused(false);
} else{
setIsDivFocused(true);
}
};


return (
<form onSubmit={handlePostHighlight} className="flex flex-col flex-1 gap-4">
<Collapsible onOpenChange={setIsDivFocused} open={isDivFocused}>
<Collapsible onOpenChange={handleCollapsibleOpenChange} open={isDivFocused}>
<div className="flex flex-col gap-2 p-2 overflow-hidden text-sm bg-white border rounded-lg ">
<CollapsibleTrigger asChild>
<div className="flex pr-2">
Expand Down

0 comments on commit 2425dc4

Please sign in to comment.