File tree Expand file tree Collapse file tree 3 files changed +14
-2
lines changed
Expand file tree Collapse file tree 3 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -12,14 +12,21 @@ import SocialLoginCard from "../SocialLoginCard";
1212import AuthenticatedUserMenu from "./AuthenticatedUserMenu" ;
1313import LanguageSwitcher from "./LanguageSwitcher" ;
1414import Link from "next/link" ;
15+ import { useAtom } from "jotai" ;
16+ import { searchBarAtom } from "@/store/search-bar.atom" ;
1517
1618const NavbarActions : React . FC = ( ) => {
1719 const { _t } = useTranslation ( ) ;
1820 const authSession = useSession ( ) ;
21+ const [ , setSearchOpen ] = useAtom ( searchBarAtom ) ;
1922
2023 return (
2124 < div className = "flex items-center gap-2" >
22- < Button variant = "ghost" className = "md:hidden" >
25+ < Button
26+ variant = "ghost"
27+ className = "md:hidden"
28+ onClick = { ( ) => setSearchOpen ( true ) }
29+ >
2330 < SearchIcon size = { 18 } />
2431 </ Button >
2532 < LanguageSwitcher />
Original file line number Diff line number Diff line change @@ -16,13 +16,15 @@ import {
1616 CommandItem ,
1717 CommandList ,
1818} from "../ui/command" ;
19+ import { useAtom } from "jotai" ;
20+ import { searchBarAtom } from "@/store/search-bar.atom" ;
1921
2022const SearchInput = ( ) => {
2123 const { _t } = useTranslation ( ) ;
2224 const router = useRouter ( ) ;
2325 const index = meilisearchClient . index ( "articles" ) ;
2426
25- const [ open , setOpen ] = React . useState ( false ) ;
27+ const [ open , setOpen ] = useAtom ( searchBarAtom ) ;
2628
2729 const debouncedSearch = useDebouncedCallback ( ( query : string ) => {
2830 mutation . mutate ( query ) ;
Original file line number Diff line number Diff line change 1+ import { atom } from "jotai" ;
2+
3+ export const searchBarAtom = atom < boolean > ( false ) ;
You can’t perform that action at this time.
0 commit comments