Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update list over consultants based on comments from PO #131

Merged
merged 1 commit into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions frontend/src/components/ConsultantListElement.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@ export default function ConsultantListElement({
<div
className={`flex flex-col ${
isListElementVisible && "bg-primary_l4"
} border-t-2 border-primary_l4 `}
} border-t border-primary_l4 `}
>
<button
className="flex flex-row gap-6 p-3 hover:bg-primary_default hover:bg-opacity-5"
className="flex flex-row gap-3 py-0.5 hover:bg-primary_default hover:bg-opacity-5"
onClick={toggleListElementVisibility}
>
<div className={`w-6 h-6 m-3 ${isListElementVisible && "rotate-180"}`}>
<div className={`w-6 h-6 m-2 ${isListElementVisible && "rotate-180"}`}>
<ChevronDown className={`text-primary_default`} />
</div>
<div className="flex flex-col gap-1 justify-center items-start">
<p className="body text-black"> {consultant.name}</p>
<div className="flex flex-col justify-center items-start">
<p className="body text-black text-sm"> {consultant.name}</p>
<p className="detail text-neutral_l1">{consultant.email}</p>
</div>
</button>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/FilteredConsultantsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
8 changes: 7 additions & 1 deletion frontend/src/components/SearchBarComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<HTMLInputElement>(null);

useEffect(() => {
Expand All @@ -22,6 +24,9 @@ export default function SearchBarComponent() {
) {
inputRef.current.focus();
}
if (e.code.includes("Escape")) {
setSearchText("");
}
}
document.addEventListener("keydown", keyDownHandler);

Expand All @@ -42,6 +47,7 @@ export default function SearchBarComponent() {
onChange={(e) => setSearchText(e.target.value)}
autoFocus
ref={inputRef}
value={searchText}
></input>
</div>
</div>
Expand Down