Skip to content

Commit

Permalink
fix: add navigate to video detail function (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
sirily11 authored May 23, 2023
1 parent fff29d0 commit 797a3d7
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions components/auth/HeaderAuthticationButtons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { SearchVideoResponse } from "@/src/services/VideoService";
import { Combobox } from "@headlessui/react";
import useTranslation from "next-translate/useTranslation";
import Link from "next/link";
import { useRouter } from "next/navigation";
import { useState } from "react";
import { QueryClient, QueryClientProvider } from "react-query";
import { CircularProgressBar } from "../shared/Placeholders";
Expand Down Expand Up @@ -57,14 +58,18 @@ export default function HeaderAuthticationButtons({
}

function SearchBar() {
const [selectedVideo, setSelectedVideo] = useState<SearchVideoResponse>();
const [query, setQuery] = useState("");
const debounceQuery = useDebounce(query, 500);
const { isLoading, data } = useSearchVideoByKeyword(debounceQuery);
const router = useRouter();

return (
<div className="w-96 hidden sm:block">
<Combobox value={selectedVideo} onChange={setSelectedVideo}>
<Combobox
onChange={(value: SearchVideoResponse) => {
router.push(`/watch/${value.id}`);
}}
>
<div className="relative">
<div className="absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none">
<svg
Expand Down

1 comment on commit 797a3d7

@vercel
Copy link

@vercel vercel bot commented on 797a3d7 May 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.