import React, { useEffect, useState } from 'react'; import { Clock, X } from 'lucide-react'; const SearchHistory = ({ onSelectBook, onClose }) => { const [history, setHistory] = useState([]); useEffect(() => { const saved = JSON.parse(localStorage.getItem('searchHistory') || '[]'); setHistory(saved.reverse()); }, []); const clearHistory = () => { localStorage.setItem('searchHistory', '[]'); setHistory([]); }; const removeItem = (book) => { const updated = history.filter(h => h.title !== book.title); setHistory(updated); localStorage.setItem('searchHistory', JSON.stringify(updated.reverse())); }; if (history.length === 0) return null; return (