Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/components/common/TableData/TableToolbar.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
"use client";

import { Input } from "@/components/ui/Input";
import { Search } from "lucide-react";
import { useQueryParams } from "@/hooks";
import { Search, X } from "lucide-react";

interface TableToolbarProps {
searchable?: boolean;
Expand All @@ -18,6 +19,13 @@ export const TableToolbar = ({
onSearchChange,
rightAction,
}: TableToolbarProps) => {
const { setParam } = useQueryParams();

const clearSearch = () => {
setParam("search", "");
onSearchChange?.("");
};

return (
<div className="flex items-center justify-between gap-4">
{/* Search Section */}
Expand All @@ -30,6 +38,7 @@ export const TableToolbar = ({
value={searchValue}
onChange={(e) => onSearchChange?.(e.target.value)}
className="pl-10"
suffix={searchValue && <X className="w-5 cursor-pointer" onClick={clearSearch} />}
/>
</div>
)}
Expand Down