-
{consultant.name}
+
+
{consultant.name}
{consultant.email}
diff --git a/frontend/src/components/FilteredConsultantsList.tsx b/frontend/src/components/FilteredConsultantsList.tsx
index 96750e34..f615f262 100644
--- a/frontend/src/components/FilteredConsultantsList.tsx
+++ b/frontend/src/components/FilteredConsultantsList.tsx
@@ -18,7 +18,7 @@ export default function FilteredConsultantList({
var newFilteredConsultants = consultants;
if (search && search.length > 0) {
newFilteredConsultants = newFilteredConsultants?.filter((consultant) =>
- consultant.name.toLowerCase().includes(search.toLowerCase()),
+ consultant.name.match(new RegExp(`\\b${search}.*\\b`, "gi")),
);
}
if (filter && filter.length > 0) {
diff --git a/frontend/src/components/SearchBarComponent.tsx b/frontend/src/components/SearchBarComponent.tsx
index 0e146b4d..f056babb 100644
--- a/frontend/src/components/SearchBarComponent.tsx
+++ b/frontend/src/components/SearchBarComponent.tsx
@@ -6,7 +6,9 @@ import { Search } from "react-feather";
export default function SearchBarComponent() {
const router = useRouter();
const searchParams = useSearchParams();
- const [searchText, setSearchText] = useState("");
+ const [searchText, setSearchText] = useState(
+ searchParams.get("search") || "",
+ );
const inputRef = useRef
(null);
useEffect(() => {
@@ -22,6 +24,9 @@ export default function SearchBarComponent() {
) {
inputRef.current.focus();
}
+ if (e.code.includes("Escape")) {
+ setSearchText("");
+ }
}
document.addEventListener("keydown", keyDownHandler);
@@ -42,6 +47,7 @@ export default function SearchBarComponent() {
onChange={(e) => setSearchText(e.target.value)}
autoFocus
ref={inputRef}
+ value={searchText}
>