-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed the explore experts page with search and filter working
- Loading branch information
Showing
6 changed files
with
108 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,47 @@ | ||
"use client"; | ||
|
||
import { Input } from "@/components/ui/input"; | ||
import { | ||
Select, | ||
SelectContent, | ||
SelectItem, | ||
SelectTrigger, | ||
SelectValue, | ||
} from "@/components/ui/select"; | ||
|
||
export type SortOption = "nameAsc" | "nameDesc" | "reviewCount" | "rating"; | ||
|
||
interface SearchBarProps { | ||
onSearch: (value: string) => void; | ||
onSort: (option: SortOption) => void; | ||
sortBy: SortOption; | ||
} | ||
|
||
export function SearchBar({ onSearch }: SearchBarProps) { | ||
export function SearchBar({ onSearch, onSort, sortBy }: SearchBarProps) { | ||
return ( | ||
<div className="border border-gray-200 rounded-lg grid items-center p-2 dark:border-gray-800"> | ||
<div className="border border-gray-200 rounded-lg grid grid-cols-[1fr,auto] items-center p-2 gap-4 dark:border-gray-800"> | ||
<Input | ||
className="appearance-none w-full border-0 focus:outline-none placeholder-gray-500 dark:placeholder-gray-400" | ||
className="appearance-none border-0 focus:outline-none placeholder-gray-500 dark:placeholder-gray-400" | ||
placeholder="Search for experts" | ||
type="search" | ||
onChange={(e) => onSearch(e.target.value)} | ||
/> | ||
<div className="w-48"> | ||
<Select | ||
value={sortBy} | ||
onValueChange={(value) => onSort(value as SortOption)} | ||
> | ||
<SelectTrigger> | ||
<SelectValue placeholder="Sort by" /> | ||
</SelectTrigger> | ||
<SelectContent> | ||
<SelectItem value="nameAsc">Name (A-Z)</SelectItem> | ||
<SelectItem value="nameDesc">Name (Z-A)</SelectItem> | ||
<SelectItem value="reviewCount">Most Reviews</SelectItem> | ||
<SelectItem value="rating">Highest Rating</SelectItem> | ||
</SelectContent> | ||
</Select> | ||
</div> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters