11"use client" ;
22
3+ import { searchQuery } from "@/functions/getYoutubeUrl" ;
34import clsx from "clsx" ;
45import { ClipboardCopy } from "lucide-react" ;
56import { useRouter , useSearchParams } from "next/navigation" ;
@@ -40,11 +41,10 @@ export const GetterInput = () => {
4041 } ;
4142 } ;
4243
43- const submitUrl = ( url : string ) => {
44- if ( url . length === 0 ) {
45- return ;
46- }
47- router . push ( `/fetch?videoUrl=${ url } ` ) ;
44+ const submitUrl = async ( url : string ) => {
45+ const getUrl = await searchQuery ( url ) ;
46+
47+ router . push ( `/fetch?videoUrl=${ getUrl } ` ) ;
4848 } ;
4949
5050 return (
@@ -59,18 +59,18 @@ export const GetterInput = () => {
5959 < div className = "relative my-4 w-full" >
6060 < input
6161 type = "text"
62- placeholder = "Enter video url "
62+ placeholder = "https://www.youtube.com/watch?v= - https://youtu.be/ - keywords "
6363 id = "video-url"
6464 name = "video-url"
65- className = "block w-full rounded-full border border-[#081721] bg-[#081721] p-2.5 text-white focus:border-blue-500 focus:ring-blue-500"
65+ className = "block w-full rounded-md border border-[#081721] bg-[#081721] p-2.5 text-white focus:border-blue-500 focus:ring-blue-500"
6666 value = { url }
6767 onChange = { ( e ) => setUrl ( e . target . value ) }
6868 />
6969 < button
7070 type = "button"
7171 id = "clipboard-copy"
7272 className = { clsx (
73- "absolute inset-y-0 right-0 flex items-center overflow-hidden rounded-r-full bg-secondary pl-2 pr-3.5 transition-all" ,
73+ "absolute inset-y-0 right-0 flex items-center overflow-hidden rounded-r-md bg-secondary px-4 transition-all" ,
7474 permission ? "opacity-100" : "bg-secondary/25" ,
7575 "hover:pointer-events-auto hover:cursor-pointer hover:bg-secondary/60 hover:opacity-100"
7676 ) }
@@ -90,7 +90,7 @@ export const GetterInput = () => {
9090 < button
9191 type = "submit"
9292 id = "search-button"
93- className = "border-1 m-auto mx-auto rounded-full border border-solid border-transparent bg-[#205D83] px-5 py-2.5 text-center text-lg font-medium text-white transition-all duration-200 ease-in-out hover:cursor-pointer hover:border-[#205D83] hover:bg-[#102F42] hover:ring-[#205D83] focus:outline-none focus:ring-2 focus:ring-blue-300 sm:w-auto disabled:opacity-50"
93+ className = "border-1 m-auto mx-auto rounded-md border border-solid border-transparent bg-[#205D83] px-5 py-2.5 text-center text-lg font-medium text-white transition-all duration-200 ease-in-out hover:cursor-pointer hover:border-[#205D83] hover:bg-[#102F42] hover:ring-[#205D83] focus:outline-none focus:ring-2 focus:ring-blue-300 sm:w-auto disabled:opacity-50"
9494 disabled = { url . length === 0 }
9595 >
9696 { false ? "Loading..." : "Search" }
0 commit comments