Merge pull request #576 from dw-0/feature/clear-search

feat: add button to clear collection search
This commit is contained in:
Anoop M D 2023-10-13 23:57:29 +05:30 committed by GitHub
commit e218b8276d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,7 +5,8 @@ import {
IconFolders, IconFolders,
IconArrowsSort, IconArrowsSort,
IconSortAscendingLetters, IconSortAscendingLetters,
IconSortDescendingLetters IconSortDescendingLetters,
IconX
} from '@tabler/icons'; } from '@tabler/icons';
import Collection from '../Collections/Collection'; import Collection from '../Collections/Collection';
import CreateCollection from '../CreateCollection'; import CreateCollection from '../CreateCollection';
@ -97,8 +98,20 @@ const Collections = () => {
spellCheck="false" spellCheck="false"
className="block w-full pl-7 py-1 sm:text-sm" className="block w-full pl-7 py-1 sm:text-sm"
placeholder="search" placeholder="search"
value={searchText}
onChange={(e) => setSearchText(e.target.value.toLowerCase())} onChange={(e) => setSearchText(e.target.value.toLowerCase())}
/> />
{searchText !== '' && (
<div className="absolute inset-y-0 right-0 pr-4 flex items-center">
<span
onClick={() => {
setSearchText('');
}}
>
<IconX size={16} strokeWidth={1.5} />
</span>
</div>
)}
</div> </div>
<div className="mt-4 flex flex-col overflow-y-auto absolute top-32 bottom-10 left-0 right-0"> <div className="mt-4 flex flex-col overflow-y-auto absolute top-32 bottom-10 left-0 right-0">