feat(notes): add note list

This commit is contained in:
devcodetools committed 2026-09-13 15:26:41 +02:00
1 parent b86baee257
commit c0cc98c293
2 files changed
+73

No files matched your search

+32
View File
@@ -0,0 +1,32 @@
import type { Note } from '../types'
interface NoteListProps {
notes: Note[]
onSelect: (id: number) => void
}
const EMPTY_MESSAGE = 'Aucune note pour le moment. Touchez + pour en créer une.'
function NoteList({ notes, onSelect }: NoteListProps) {
if (notes.length === 0) {
return <p className="text-center text-gray-500">{EMPTY_MESSAGE}</p>
}
return (
<ul className="flex flex-col">
{notes.map((note) => (
<li key={note.id}>
<button
type="button"
onClick={() => onSelect(note.id)}
className="w-full px-4 py-4 text-left hover:bg-gray-100"
>
{note.title || <span className="italic text-gray-400">Sans titre</span>}
</button>
</li>
))}
</ul>
)
}
export default NoteList