import Link from 'next/link'; import Layout from '../../components/layout'; import { toRelativeDate } from '../../lib/date'; import NotesInfo from '../../public/notes.json'; function NoteEntry({ note }: { note: { title: string, mtime: string, slug: string } }) { return ( {note.title} {note.mtime && toRelativeDate(note.mtime)} ); } function NotesPage() { const notes = Object.entries(NotesInfo) .map(([slug, note]) => { return { slug, title: note.title, mtime: new Date(note.mtime) } }) .sort( (a, b) => { return b.mtime.getTime() - a.mtime.getTime(); } ); return ( { !notes || notes.length === 0 && <>No notes found || {notes.map( (note: any, i: number) => { return (); } )}
}
) } export default NotesPage;