many bug fixes + add links and collections together + more changes

This commit is contained in:
daniel31x13
2023-12-01 16:29:17 -05:00
parent a3c6d9b42e
commit a36769c521
27 changed files with 169 additions and 190 deletions
+7 -5
View File
@@ -1,6 +1,6 @@
import { faMagnifyingGlass } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { useState } from "react";
import { useEffect, useState } from "react";
import { useRouter } from "next/router";
import { toast } from "react-hot-toast";
@@ -11,11 +11,13 @@ type Props = {
export default function SearchBar({ placeholder }: Props) {
const router = useRouter();
const routeQuery = router.query.q;
const [searchQuery, setSearchQuery] = useState("");
const [searchQuery, setSearchQuery] = useState(
routeQuery ? decodeURIComponent(routeQuery as string) : ""
);
useEffect(() => {
router.query.q
? setSearchQuery(decodeURIComponent(router.query.q as string))
: setSearchQuery("");
}, [router.query.q]);
return (
<div className="flex items-center relative group">