-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
/store -> /store/search 카테고리별 검색 기능 구현
- Loading branch information
1 parent
d85b1b8
commit b9e38c5
Showing
4 changed files
with
64 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
"use client"; | ||
|
||
import Link from "next/link"; | ||
import { useDispatch } from "react-redux"; | ||
import { setSearchQuery } from "@/redux/slice/searchSlice"; | ||
|
||
interface CategoryToSearchLinkProps { | ||
to: string; | ||
searchQuery: string; | ||
[x: string]: any; | ||
children: React.ReactNode; | ||
} | ||
const CategoryToSearchLink = ({ | ||
to, | ||
searchQuery, | ||
children, | ||
...restProps | ||
}: CategoryToSearchLinkProps) => { | ||
const dispatch = useDispatch(); | ||
const handleSearch = () => { | ||
dispatch(setSearchQuery(searchQuery)); | ||
}; | ||
return ( | ||
<Link href={to} {...restProps} onClick={handleSearch}> | ||
{children} | ||
</Link> | ||
); | ||
}; | ||
|
||
export default CategoryToSearchLink; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters