chore: use search-box in logs and connections

This commit is contained in:
dongchengjie
2024-05-17 19:44:42 +08:00
parent b95b9bdaf3
commit 31d301064a
3 changed files with 14 additions and 23 deletions

View File

@@ -11,9 +11,8 @@ type SearchProps = {
placeholder?: string;
onSearch: (
match: (content: string) => boolean,
search: (contents: string[]) => string[],
state: {
input: string;
text: string;
matchCase: boolean;
matchWholeWord: boolean;
useRegularExpression: boolean;
@@ -41,9 +40,8 @@ export const BaseSearchBox = styled((props: SearchProps) => {
const onChange = (e: ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => {
props.onSearch(
(content) => doSearch([content], e.target?.value ?? "").length > 0,
(contents: string[]) => doSearch(contents, e.target?.value ?? ""),
{
input: e.target?.value ?? "",
text: e.target?.value ?? "",
matchCase,
matchWholeWord,
useRegularExpression,
@@ -74,8 +72,8 @@ export const BaseSearchBox = styled((props: SearchProps) => {
} else {
return item.includes(searchItemCopy);
}
} catch (e) {
setErrorMessage(`${e}`);
} catch (err) {
setErrorMessage(`${err}`);
}
});
};