// The project's notes, one row each. A server component: it holds no state, and every string is passed in. import type { ReactElement } from "react" import type { NoteView } from "../contract/index.js" export interface NoteListLabels { readonly caption: string readonly empty: string readonly note: string readonly attachments: string readonly updated: string /** `Open {title}`: the link's accessible name, so a list of links is not a list of the same word. */ readonly open: string } export function NoteList({ notes, hrefFor, labels, formatDate, }: { notes: readonly NoteView[] hrefFor: (noteId: string) => string labels: NoteListLabels formatDate: (iso: string) => string }): ReactElement { if (notes.length === 0) { return
{labels.empty}
} return ( // guide: The notes of this project| {labels.note} | {labels.attachments} | {labels.updated} |
|---|---|---|
| {note.title} | {note.attachmentCount} | {formatDate(note.updatedAt)} |