Update Sidebar.tsx

This commit is contained in:
Morgan Sun 2024-09-17 22:20:58 -04:00
parent aada99d55b
commit 4cd40ca312

View file

@ -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">
@ -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}