blob: 089501e1959cf821210911e07f524103372a2132 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
"use client"
import * as React from "react"
import { Search, Download } from "lucide-react"
import { Input } from "@/components/ui/input"
import { Button } from "@/components/ui/button"
interface ClientTableToolbarProps {
globalFilter: string
setGlobalFilter: (value: string) => void
totalRows: number
visibleRows: number
onExport?: () => void
actions?: React.ReactNode
customToolbar?: React.ReactNode
viewOptions?: React.ReactNode
}
export function ClientTableToolbar({
globalFilter,
setGlobalFilter,
totalRows,
visibleRows,
onExport,
actions,
customToolbar,
viewOptions,
}: ClientTableToolbarProps) {
return (
<div className="flex w-full items-center justify-between gap-4 p-1 overflow-x-auto">
<div className="flex items-center gap-2">
<div className="relative max-w-sm min-w-[200px]">
<Search className="absolute left-2 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" />
<Input
placeholder="Search all columns..."
value={globalFilter ?? ""}
onChange={(e) => setGlobalFilter(e.target.value)}
className="pl-8"
/>
</div>
<div className="text-sm text-muted-foreground whitespace-nowrap">
Showing {visibleRows} of {totalRows}
</div>
{viewOptions}
{onExport && (
<Button onClick={onExport} variant="outline" size="sm">
<Download className="mr-2 h-4 w-4" />
Export
</Button>
)}
</div>
<div className="flex items-center gap-2 shrink-0">
{customToolbar}
{actions}
</div>
</div>
)
}
|