dep ver bump; clean-up; minor updates
Signed-off-by: Paul W. <lambdapaul@protonmail.com>
This commit is contained in:
+42
-42
@@ -6,52 +6,52 @@ import { toRelativeDate } from '../../lib/date';
|
||||
import NotesInfo from '../../public/notes.json';
|
||||
|
||||
function NoteEntry({ note }: { note: { title: string, mtime: string, slug: string } }) {
|
||||
return (
|
||||
<tr>
|
||||
<td style={{ flex: '1 0 50%' }}>
|
||||
<Link href={`/notes/${note.slug}`}>
|
||||
{note.title}
|
||||
</Link>
|
||||
</td>
|
||||
<td style={{ fontStyle: 'italic' }}>
|
||||
{note.mtime && toRelativeDate(note.mtime)}
|
||||
</td>
|
||||
</tr>
|
||||
);
|
||||
return (
|
||||
<tr>
|
||||
<td style={{ flex: '1 0 50%' }}>
|
||||
<Link href={`/notes/${note.slug}`}>
|
||||
{note.title}
|
||||
</Link>
|
||||
</td>
|
||||
<td style={{ fontStyle: 'italic' }}>
|
||||
{note.mtime && toRelativeDate(note.mtime)}
|
||||
</td>
|
||||
</tr>
|
||||
);
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
);
|
||||
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 (
|
||||
<Layout>
|
||||
{
|
||||
!notes || notes.length === 0
|
||||
&& <>No notes found</>
|
||||
|| <table>
|
||||
<tbody>
|
||||
{notes.map(
|
||||
(note: any) => {
|
||||
return (<NoteEntry note={note} key={note.slug} />);
|
||||
}
|
||||
)}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
</Layout>
|
||||
)
|
||||
return (
|
||||
<Layout>
|
||||
{
|
||||
!notes || notes.length === 0
|
||||
&& <>No notes found</>
|
||||
|| <table>
|
||||
<tbody>
|
||||
{notes.map(
|
||||
(note: any) => {
|
||||
return (<NoteEntry note={note} key={note.slug} />);
|
||||
}
|
||||
)}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
</Layout>
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user