diff --git a/src/components/SearchBar/SearchBar.jsx b/src/components/SearchBar/SearchBar.jsx
index 8fb8b7b..4c2407f 100644
--- a/src/components/SearchBar/SearchBar.jsx
+++ b/src/components/SearchBar/SearchBar.jsx
@@ -1,4 +1,4 @@
-import { SearchIcon } from "@chakra-ui/icons";
+import { ChevronDownIcon, ChevronUpIcon, SearchIcon } from "@chakra-ui/icons";
import {
Box,
Button,
@@ -6,9 +6,17 @@ import {
Input,
InputGroup,
InputLeftElement,
+ Tab,
+ TabList,
+ TabPanel,
+ TabPanels,
+ Tabs,
+ Text,
+ useDisclosure,
} from "@chakra-ui/react";
import { useEffect, useState } from "react";
import { Form, useForm, useFormState } from "react-final-form";
+import Tag from "../Tag";
const SearchBarComponent = (props) => {
const {
@@ -16,6 +24,7 @@ const SearchBarComponent = (props) => {
setResetSearch,
handleSubmit,
searchInput,
+ isClickedSearch,
setSearchInput,
tagToClear,
setTagToClear,
@@ -26,6 +35,7 @@ const SearchBarComponent = (props) => {
const { values } = useFormState();
const { mutators } = useForm();
+ const { isOpen, onToggle } = useDisclosure();
const searchPlaceholder = "Search within " + pageType;
useEffect(() => {
@@ -45,10 +55,21 @@ const SearchBarComponent = (props) => {
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [tagToClear, setTagToClear]);
+ const handleApplyFiltersClick = (handleSubmit) => {
+ onToggle();
+ handleSubmit();
+ };
+
const handleSearchInputChange = (e) => {
setSearchInput(e.target.value);
};
+ const getNumTagsFiltered = (values) => {
+ return isClickedSearch && values.tagArray && values.tagArray.length > 0
+ ? `(${values.tagArray.length})`
+ : "";
+ };
+
const SearchButton = ({ handleSubmit }) => {
return (
);
};
-
+ const calculateRight = () => {
+ if (!isClickedSearch || !values.tagArray || values.tagArray.length == 0)
+ return "238px";
+ if (values.tagArray.length >= 10) {
+ return "274px";
+ }
+ return "263px";
+ };
return (
-
-
-
- {/* search bar */}
-
-
-
-
-
-
-
- {/* Submit search button */}
-
-
+
+
+
+
+
+
+
+
+
+ {isOpen ? (
+
+
+
+
+ Filter {getNumTagsFiltered(values)}
+
+
+
+
+
+ ) : (
+
+ )}
+
+
+
+
+
+
+
+
+
);
};