Merge pull request #870 from NarrowCode/fix/search-whitespace

fix: allow whitespaces in device search (#869)
This commit is contained in:
Manoj Vivek 2023-03-22 15:12:07 +05:30 committed by GitHub
commit e0433487a7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -15,9 +15,11 @@ import DeviceLabel, { DND_TYPE } from './DeviceLabel';
import DeviceDetailsModal from './DeviceDetailsModal';
const filterDevices = (devices: Device[], filter: string) => {
const sanitizedFilter = filter.trim().toLowerCase();
return devices.filter((device: Device) =>
`${device.name.toLowerCase()}${device.width}x${device.height}`.includes(
filter
sanitizedFilter
)
);
};
@ -108,11 +110,9 @@ const DeviceManager = () => {
<Icon icon="ic:outline-search" height={24} />
<input
className="w-60 rounded bg-inherit px-2 py-1 focus:outline-none"
placeholder="Search.."
placeholder="Search ..."
value={searchText}
onChange={(e) =>
setSearchText(e.target.value.trim().toLowerCase())
}
onChange={(e) => setSearchText(e.target.value)}
/>
</div>
</div>