Skip to content

Commit

Permalink
feat: update header
Browse files Browse the repository at this point in the history
  • Loading branch information
haru52 committed Jun 1, 2024
1 parent e324afa commit 617e2d3
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/app/_components/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import Image from "next/image";
import Link from "next/link";
import { useRouter } from "next/navigation";
import { useState } from "react";
import { useRouter, useSearchParams } from "next/navigation";
import { useEffect, useState } from "react";
import { defaultUserIconPath, loginPath, logoutPath } from "~/consts";
import type { Social } from "~/entities/social";
import type { User } from "~/entities/user";
Expand All @@ -19,6 +19,11 @@ export function Header({
}) {
const router = useRouter();
const [searchQuery, setSearchQuery] = useState("");
const searchParams = useSearchParams();
const searchParamQ = searchParams.get("q");
useEffect(() => {
setSearchQuery(searchParamQ ?? "");
}, [searchParamQ]);

return (
<div className="navbar bg-base-100">
Expand Down

0 comments on commit 617e2d3

Please sign in to comment.