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-03-10 04:34:45 +00:00
|
|
|
<div className='block'>
|
2024-02-13 23:01:07 +00:00
|
|
|
<h2>Recent Notes</h2>
|
2024-03-10 04:34:45 +00:00
|
|
|
<ul>
|
2024-02-13 23:01:07 +00:00
|
|
|
{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>
|
2024-03-10 04:34:45 +00:00
|
|
|
</div>
|
2022-04-28 16:37:12 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2023-09-20 04:25:34 +00:00
|
|
|
export default RecentNotes;
|