@@ -23,7 +23,7 @@ import {
23
23
24
24
import "../App.css" ;
25
25
26
- import React , { useRef , useState } from "react" ;
26
+ import React , { useContext , useRef , useState } from "react" ;
27
27
import unIcon from "../icons/icon1.png" ;
28
28
import bell from "../icons/bell.png" ;
29
29
import hemb from "../icons/hemb.png" ;
@@ -36,9 +36,16 @@ import SubmitPhoto from "../PopOver/SubmitPhoto.jsx";
36
36
import ExtraLink from "../PopOver/ExtraLink" ;
37
37
import Recomandation from "../PopOver/Recomandation" ;
38
38
import Menubar from "./Menubar" ;
39
+ import { ImgContext } from "../Context/ImgContext" ;
40
+ import { useNavigate } from "react-router-dom" ;
39
41
40
42
//////////////////////////////////////////////////////////////////////////////////
41
43
const Navbar = ( ) => {
44
+
45
+ const { fetchdata} = useContext ( ImgContext )
46
+
47
+ const nav = useNavigate ( )
48
+
42
49
const { isOpen, onOpen, onClose } = useDisclosure ( ) ;
43
50
const [ scrollBehavior , setScrollBehavior ] = useState ( "inside" ) ;
44
51
@@ -79,6 +86,12 @@ const Navbar = () => {
79
86
placeholder = " Search free high resolution-photos"
80
87
borderRadius = "40px"
81
88
bgColor = "rgb(238,238,238)"
89
+ // value={query}
90
+ onKeyPress = { ( e ) => {
91
+ if ( e . key === "Enter" ) {
92
+ fetchdata ( e . target . value )
93
+ nav ( "/search" )
94
+ } } }
82
95
/>
83
96
</ PopoverTrigger >
84
97
0 commit comments