Merge pull request #2993 from H0llyW00dzZ/masks

This commit is contained in:
Yifei Zhang 2023-10-11 11:42:45 +08:00 committed by GitHub
commit ba67f13ad5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -393,11 +393,13 @@ export function MaskPage() {
const [searchText, setSearchText] = useState("");
const masks = searchText.length > 0 ? searchMasks : allMasks;
// simple search, will refactor later
// refactored already, now it accurate
const onSearch = (text: string) => {
setSearchText(text);
if (text.length > 0) {
const result = allMasks.filter((m) => m.name.includes(text));
const result = allMasks.filter((m) =>
m.name.toLowerCase().includes(text.toLowerCase())
);
setSearchMasks(result);
} else {
setSearchMasks(allMasks);