Skip to content

Commit

Permalink
Merge pull request voideditor#25 from sunmorgan/mdev
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewpareles authored Sep 18, 2024
2 parents a299cd5 + 4cd40ca commit 085e622
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions extensions/void/src/sidebar/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,11 @@ const Sidebar = () => {

}, [messageStream])

//Clear code selection
const clearSelection = () => {
setSelection(null);
};

return <>
<div className="flex flex-col h-full w-full">
<div className="flex-grow overflow-y-auto overflow-x-hidden p-4">
Expand All @@ -259,8 +264,17 @@ const Sidebar = () => {
<FilesSelector files={files} setFiles={setFiles} />
{/* selected code */}
{!selection?.selectionStr ? null
: <BlockCode text={selection?.selectionStr} disableApplyButton={true} />
}
: (
<div className="relative">
<button
onClick={clearSelection}
className="absolute top-2 right-2 text-white hover:text-gray-300 z-10"
>
X
</button>
<BlockCode text={selection.selectionStr} disableApplyButton={true} />
</div>
)}
</div>
<form
ref={formRef}
Expand Down

0 comments on commit 085e622

Please sign in to comment.