import { useState } from 'react'; import { Search, Plus, Trash2, Save, Book, Tag } from 'lucide-react'; export default function NotesApp() { const categories = [ { id: 'homework', label: 'Homework', color: 'bg-blue-100 text-blue-800' }, { id: 'lecture', label: 'Lecture Notes', color: 'bg-green-100 text-green-800' }, { id: 'exam', label: 'Exam Prep', color: 'bg-purple-100 text-purple-800' }, { id: 'project', label: 'Projects', color: 'bg-yellow-100 text-yellow-800' }, { id: 'research', label: 'Research', color: 'bg-pink-100 text-pink-800' }, ]; const [notes, setNotes] = useState([]); const [currentNote, setCurrentNote] = useState({ title: '', content: '', subject: '', category: '' }); const [searchTerm, setSearchTerm] = useState(''); const [selectedCategory, setSelectedCategory] = useState(''); const addNote = () => { if (currentNote.title.trim() && currentNote.content.trim()) { setNotes([...notes, { ...currentNote, id: Date.now() }]); setCurrentNote({ title: '', content: '', subject: '', category: '' }); } }; const deleteNote = (id) => { setNotes(notes.filter(note => note.id !== id)); }; const filteredNotes = notes.filter(note => { const matchesSearch = ( note.title.toLowerCase().includes(searchTerm.toLowerCase()) || note.content.toLowerCase().includes(searchTerm.toLowerCase()) || note.subject.toLowerCase().includes(searchTerm.toLowerCase()) ); const matchesCategory = selectedCategory ? note.category === selectedCategory : true; return matchesSearch && matchesCategory; }); const getCategoryColor = (categoryId) => { return categories.find(cat => cat.id === categoryId)?.color || 'bg-gray-100 text-gray-800'; }; const getCategoryLabel = (categoryId) => { return categories.find(cat => cat.id === categoryId)?.label || 'Uncategorized'; }; return (

Student Notes

setSearchTerm(e.target.value)} />
{/* Category Filter */}
{categories.map((category) => ( ))}
{/* Note Editor */}
setCurrentNote({ ...currentNote, title: e.target.value })} />
setCurrentNote({ ...currentNote, subject: e.target.value })} />