26 lines
808 B
TypeScript
26 lines
808 B
TypeScript
import { ProductGrid } from "@/components/product-grid"
|
||
import { SAMPLE_PRODUCTS } from "@/lib/sample-products"
|
||
|
||
export default function SearchPage({
|
||
searchParams
|
||
}: {
|
||
searchParams: { q: string }
|
||
}) {
|
||
const searchTerm = searchParams.q || ''
|
||
const filteredProducts = SAMPLE_PRODUCTS.filter(product =>
|
||
product.title.toLowerCase().includes(searchTerm.toLowerCase())
|
||
)
|
||
|
||
return (
|
||
<div className="container mx-auto px-4 py-8">
|
||
<h1 className="text-2xl font-bold mb-6">Результаты поиска для "{searchTerm}"</h1>
|
||
{filteredProducts.length > 0 ? (
|
||
<ProductGrid products={filteredProducts} />
|
||
) : (
|
||
<p className="text-center text-gray-500">По вашему запросу ничего не найдено</p>
|
||
)}
|
||
</div>
|
||
)
|
||
}
|
||
|