'use client'; import { useState } from 'react'; import Link from 'next/link'; import type { Recipe } from '../../features/inventory/types'; function RecipePlaceholder({ name }: { name: string }) { const initial = name.trim().charAt(0).toUpperCase() || '?'; return (
{initial}
); } export default function RecipeGrid({ recipes }: { recipes: Recipe[] }) { const [search, setSearch] = useState(''); const filtered = recipes.filter((r) => r.name.toLowerCase().includes(search.toLowerCase()), ); return (
setSearch(e.target.value)} style={{ width: '100%', padding: '0.6rem 1rem', fontSize: '1rem', border: '1px solid #ced4da', borderRadius: '24px', outline: 'none', boxSizing: 'border-box', }} />
{filtered.length === 0 && (

{search ? 'Inga recept matchar sökningen.' : 'Inga recept tillagda ännu.'}

)}
{filtered.map((recipe) => (
((e.currentTarget as HTMLDivElement).style.boxShadow = '0 4px 12px rgba(0,0,0,0.12)') } onMouseLeave={(e) => ((e.currentTarget as HTMLDivElement).style.boxShadow = 'none') } > {recipe.imageUrl ? ( {recipe.name} ) : ( )}

{recipe.name}

{recipe.description && (

{recipe.description}

)}
))}
); }