From ae6c6f7103bac5c7b9f867a350d176c64ea04923 Mon Sep 17 00:00:00 2001 From: Kevin Wu Date: Wed, 3 Apr 2024 13:39:01 -0700 Subject: [PATCH] style: replace sort, institution dropdowns with shadcn --- components/search/Search.tsx | 25 +++---- components/search/filter/FilterComponents.tsx | 74 ++++++++++--------- 2 files changed, 50 insertions(+), 49 deletions(-) diff --git a/components/search/Search.tsx b/components/search/Search.tsx index 1ee8bbd..a1e9079 100644 --- a/components/search/Search.tsx +++ b/components/search/Search.tsx @@ -338,21 +338,16 @@ const Search = () => { Search Filters -
-
- Sort By: -
- -
+ {loading ? ( diff --git a/components/search/filter/FilterComponents.tsx b/components/search/filter/FilterComponents.tsx index 14ef6f0..319bedb 100644 --- a/components/search/filter/FilterComponents.tsx +++ b/components/search/filter/FilterComponents.tsx @@ -1,7 +1,7 @@ "use client"; import React, { ChangeEvent, Dispatch, SetStateAction, useState } from "react"; -import { FaCheck, FaChevronDown } from "react-icons/fa"; +import { FaCheck } from "react-icons/fa"; import { CollegeObject } from "../Search"; import { format } from "date-fns"; @@ -11,6 +11,13 @@ import { PopoverContent, PopoverTrigger, } from "@/components/ui/popover"; +import { + Select, + SelectContent, + SelectItem, + SelectTrigger, + SelectValue, +} from "@/components/ui/select"; import { Button } from "../../ui/button"; import { CalendarIcon } from "lucide-react"; @@ -187,9 +194,9 @@ export const InstitutionDropdown = (props: InstitutionDropdownProps) => { const [value, setValue] = useState(defaultValue); - const handleChange = (e: ChangeEvent) => { - onChange(e.target.value); - setValue(e.target.value); + const handleChange = (value: string) => { + onChange(value); + setValue(value); }; const uniqueColleges = @@ -214,21 +221,21 @@ export const InstitutionDropdown = (props: InstitutionDropdownProps) => {
Teaching Institution
-
- + + + + + + Any Institution + + {uniqueColleges.map((college) => ( + + {college} + ))} - -
- -
-
+ +
); @@ -300,27 +307,26 @@ export const SortDropdown = (props: SortDropdownProps) => { const [value, setValue] = useState(defaultValue); - const handleChange = (e: ChangeEvent) => { - onChange(e.target.value); - setValue(e.target.value); + const handleChange = (value: string) => { + onChange(value); + setValue(value); }; return ( -
-
- + + + + {data.map((item) => ( - + + {item} + ))} - -
- -
-
+ +
); };