refactor: extract FilterBar component
This commit is contained in:
@@ -7,6 +7,7 @@ import PageShell from '@/components/PageShell';
|
|||||||
import Scanner from '@/components/Scanner';
|
import Scanner from '@/components/Scanner';
|
||||||
import StatCard from '@/components/StatCard';
|
import StatCard from '@/components/StatCard';
|
||||||
import InventoryTable from '@/components/InventoryTable';
|
import InventoryTable from '@/components/InventoryTable';
|
||||||
|
import FilterBar from '@/components/FilterBar';
|
||||||
import { useInventoryFilter } from '@/hooks/useInventoryFilter';
|
import { useInventoryFilter } from '@/hooks/useInventoryFilter';
|
||||||
import { toast } from 'react-hot-toast';
|
import { toast } from 'react-hot-toast';
|
||||||
import {
|
import {
|
||||||
@@ -24,7 +25,6 @@ import {
|
|||||||
Layout,
|
Layout,
|
||||||
Printer,
|
Printer,
|
||||||
Download,
|
Download,
|
||||||
Search,
|
|
||||||
Box
|
Box
|
||||||
} from 'lucide-react';
|
} from 'lucide-react';
|
||||||
import { generateBarcode128, getQRCodeURL } from '@/lib/labels';
|
import { generateBarcode128, getQRCodeURL } from '@/lib/labels';
|
||||||
@@ -289,18 +289,10 @@ export default function InventoryPage() {
|
|||||||
</section>
|
</section>
|
||||||
|
|
||||||
{/* Search */}
|
{/* Search */}
|
||||||
<div className="relative">
|
<FilterBar
|
||||||
<input
|
searchQuery={searchQuery}
|
||||||
type="text"
|
onChange={setSearchQuery}
|
||||||
placeholder="Search catalog..."
|
/>
|
||||||
value={searchQuery}
|
|
||||||
onChange={(e) => setSearchQuery(e.target.value)}
|
|
||||||
className="w-full bg-surface border border-slate-800 rounded-2xl py-3.5 pr-4 pl-11 text-sm focus:border-primary outline-none transition-all placeholder:text-secondary"
|
|
||||||
/>
|
|
||||||
<div className="absolute left-4 top-1/2 -translate-y-1/2 text-secondary">
|
|
||||||
<Search size={18} />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* Inventory Table */}
|
{/* Inventory Table */}
|
||||||
<InventoryTable
|
<InventoryTable
|
||||||
|
|||||||
25
frontend/components/FilterBar.tsx
Normal file
25
frontend/components/FilterBar.tsx
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
'use client';
|
||||||
|
|
||||||
|
import { Search } from 'lucide-react';
|
||||||
|
|
||||||
|
interface FilterBarProps {
|
||||||
|
searchQuery: string;
|
||||||
|
onChange: (value: string) => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function FilterBar({ searchQuery, onChange }: FilterBarProps) {
|
||||||
|
return (
|
||||||
|
<div className="relative">
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
placeholder="Search catalog..."
|
||||||
|
value={searchQuery}
|
||||||
|
onChange={(e) => onChange(e.target.value)}
|
||||||
|
className="w-full bg-surface border border-slate-800 rounded-2xl py-3.5 pr-4 pl-11 text-sm focus:border-primary outline-none transition-all placeholder:text-secondary"
|
||||||
|
/>
|
||||||
|
<div className="absolute left-4 top-1/2 -translate-y-1/2 text-secondary">
|
||||||
|
<Search size={18} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user