2022-04-28 16:37:12 +00:00
|
|
|
import Link from "next/link";
|
2023-10-30 04:18:38 +00:00
|
|
|
import NotesInfo from '../public/notes.json';
|
2022-04-28 16:37:12 +00:00
|
|
|
|
2023-10-30 04:18:38 +00:00
|
|
|
function RecentNotes() {
|
2024-02-13 23:01:07 +00:00
|
|
|
const notes = Object.entries(NotesInfo).reverse();
|
2022-05-15 13:56:45 +00:00
|
|
|
return (
|
2024-02-13 23:01:07 +00:00
|
|
|
<ul className='block'>
|
|
|
|
<h2>Recent Notes</h2>
|
|
|
|
{notes?.slice(0, 5)
|
|
|
|
.map(([slug, note]: any, i: number) => {
|
|
|
|
return (
|
|
|
|
<li
|
|
|
|
key={i}
|
|
|
|
>
|
|
|
|
<Link
|
|
|
|
href={`/notes/${slug}`}>
|
|
|
|
{note.title}
|
|
|
|
</Link>
|
|
|
|
</li>
|
|
|
|
);
|
2022-05-15 13:56:45 +00:00
|
|
|
})
|
|
|
|
}
|
|
|
|
{
|
2024-02-13 23:01:07 +00:00
|
|
|
notes.length > 5 &&
|
|
|
|
<Link href='/notes'>More...</Link>
|
2022-05-15 13:56:45 +00:00
|
|
|
}
|
2024-02-13 23:01:07 +00:00
|
|
|
</ul>
|
2022-04-28 16:37:12 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2023-09-20 04:25:34 +00:00
|
|
|
export default RecentNotes;
|