Correct date gen. for /notes
This commit is contained in:
parent
d3fcb015ab
commit
9636d3b70e
1
next-env.d.ts
vendored
1
next-env.d.ts
vendored
@ -1,6 +1,5 @@
|
|||||||
/// <reference types="next" />
|
/// <reference types="next" />
|
||||||
/// <reference types="next/image-types/global" />
|
/// <reference types="next/image-types/global" />
|
||||||
/// <reference types="next/navigation-types/compat/navigation" />
|
|
||||||
|
|
||||||
// NOTE: This file should not be edited
|
// NOTE: This file should not be edited
|
||||||
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
|
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
|
||||||
|
17
src/app/components/note-entry.tsx
Normal file
17
src/app/components/note-entry.tsx
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
'use client'
|
||||||
|
import Link from 'next/link';
|
||||||
|
import { toRelativeDate } from '../lib/date';
|
||||||
|
export 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>
|
||||||
|
);
|
||||||
|
}
|
@ -1,22 +1,5 @@
|
|||||||
import Link from 'next/link';
|
|
||||||
|
|
||||||
import { toRelativeDate } from '../lib/date';
|
|
||||||
import NotesInfo from '../../../public/notes.json';
|
import NotesInfo from '../../../public/notes.json';
|
||||||
|
import { NoteEntry } from '../components/note-entry';
|
||||||
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>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function NotesPage() {
|
function NotesPage() {
|
||||||
const notes = Object.entries(NotesInfo)
|
const notes = Object.entries(NotesInfo)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user