File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
src/components/common/TableData Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change 11"use client" ;
22
33import { Input } from "@/components/ui/Input" ;
4- import { Search } from "lucide-react" ;
4+ import { useQueryParams } from "@/hooks" ;
5+ import { Search , X } from "lucide-react" ;
56
67interface TableToolbarProps {
78 searchable ?: boolean ;
@@ -18,6 +19,13 @@ export const TableToolbar = ({
1819 onSearchChange,
1920 rightAction,
2021} : TableToolbarProps ) => {
22+ const { setParam } = useQueryParams ( ) ;
23+
24+ const clearSearch = ( ) => {
25+ setParam ( "search" , "" ) ;
26+ onSearchChange ?.( "" ) ;
27+ } ;
28+
2129 return (
2230 < div className = "flex items-center justify-between gap-4" >
2331 { /* Search Section */ }
@@ -30,6 +38,7 @@ export const TableToolbar = ({
3038 value = { searchValue }
3139 onChange = { ( e ) => onSearchChange ?.( e . target . value ) }
3240 className = "pl-10"
41+ suffix = { searchValue && < X className = "w-5 cursor-pointer" onClick = { clearSearch } /> }
3342 />
3443 </ div >
3544 ) }
You can’t perform that action at this time.
0 commit comments