Skip to content

Commit

Permalink
feat: make search filter components controlled
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinWu098 committed Dec 2, 2024
1 parent cf92637 commit 122186f
Show file tree
Hide file tree
Showing 7 changed files with 292 additions and 361 deletions.
10 changes: 5 additions & 5 deletions src/components/search/Search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import React, { useEffect, useState } from "react";
import Link from "next/link";
import { useRouter, useSearchParams } from "next/navigation";
import { SearchFilterDialog } from "@/components/search/filter/search-filter-dialog";
import { SearchFilterSortDropdown } from "@/components/search/filter/search-filter-sort-dropdown";
import { SearchBlurb } from "@/components/search/search-blurb";
import { analyticsEnum, logAnalytics } from "@/lib/analytics";
import { UNIVERSITY_GE } from "@/lib/constants";
Expand All @@ -13,7 +14,6 @@ import { filterData } from "../../lib/utils/filter";
import { queryDatabase } from "../../lib/utils/query-db";
import { ToastAction } from "../ui/toast";
import { useToast } from "../ui/use-toast";
import { SortDropdown } from "./filter/FilterComponents";
import { SearchFilter } from "./filter/search-filter";
import ScrollToTop from "./ScrollToTop";
import SearchResults from "./SearchResults";
Expand Down Expand Up @@ -103,7 +103,7 @@ const Search = () => {

const [format, setFormat] = useState([true, true]);
const [enrollment, setEnrollment] = useState([true]);
const [available, setAvailable] = useState([false]);
const [available, setAvailable] = useState([true]);
const [start, setStart] = useState<Date>();
const [end, setEnd] = useState<Date>();
const [institution, setInstitution] = useState("Any Institution");
Expand Down Expand Up @@ -305,15 +305,15 @@ const Search = () => {
/>
</SearchFilterDialog>

<SortDropdown
defaultValue={sort}
<SearchFilterSortDropdown
value={sort}
onChange={setSort}
data={[
"Default Sort",
"Alphabetical",
"Tuition",
"Shortest Term",
]}
onChange={setSort}
/>
</div>

Expand Down
340 changes: 0 additions & 340 deletions src/components/search/filter/FilterComponents.tsx

This file was deleted.

Loading

0 comments on commit 122186f

Please sign in to comment.