Skip to content

Commit

Permalink
fix: fix serach bar and refresh router when first loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
MR-Addict committed Oct 26, 2024
1 parent f44ab2b commit d1457ba
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 81 deletions.
6 changes: 3 additions & 3 deletions src/app/view/components/Searchbar/Searchbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default function Searchbar() {
const [localSearchKeywords, setLocalSearchKeywords] = useState("");

useEffect(() => {
const timer = setTimeout(() => setSearchKeywords(localSearchKeywords), 500);
const timer = setTimeout(() => setSearchKeywords(localSearchKeywords.toLocaleLowerCase()), 500);
return () => clearTimeout(timer);
}, [localSearchKeywords]);

Expand All @@ -32,8 +32,8 @@ export default function Searchbar() {
{localSearchKeywords.length !== 0 && (
<button
type="button"
aria-label="clear button"
className="hover:md:bg-black/30 bg-black/10 rounded-full p-1"
aria-label="clear"
className="hover:md:bg-black/20 bg-black/10 rounded-full p-1"
onClick={() => setLocalSearchKeywords("")}
>
<AiOutlineClose size={13} />
Expand Down
3 changes: 3 additions & 0 deletions src/contexts/App/AppProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"use client";

import { useRouter } from "next/navigation";
import { PublicEnv, PublicEnvType } from "@/types/env";
import { createContext, useContext, useState, useEffect } from "react";

Expand All @@ -16,9 +17,11 @@ interface AppContextProviderProps {
}

export const AppContextProvider = ({ children }: AppContextProviderProps) => {
const router = useRouter();
const [env, setEnv] = useState<PublicEnvType | null>(null);

useEffect(() => {
setTimeout(() => router.refresh(), 1000);
fetch("/api/env")
.then((res) => res.json())
.then((res) => setEnv(PublicEnv.parse(res)));
Expand Down
18 changes: 0 additions & 18 deletions src/contexts/Popup/Popup.module.css

This file was deleted.

22 changes: 0 additions & 22 deletions src/contexts/Popup/Popup.tsx

This file was deleted.

38 changes: 0 additions & 38 deletions src/contexts/Popup/PopupProvider.tsx

This file was deleted.

0 comments on commit d1457ba

Please sign in to comment.