www/components/recent-notes.tsx

27 lines
822 B
TypeScript
Raw Normal View History

2022-04-28 16:37:12 +00:00
import Link from "next/link";
import { NoteMeta } from "../util/slug";
function RecentNotes({ notesMeta }: { notesMeta: NoteMeta[] }) {
2022-05-15 13:56:45 +00:00
return (
<div className='block'>
<div className='h2'>Recent Notes</div>
{notesMeta?.slice(0, 10)
.map((note: any) => {
return <Link key={note.slug} href={`/notes/${note.slug}`}>
2022-04-28 16:37:12 +00:00
<a className={`button link`}>{note.title}</a>
</Link>
2022-05-15 13:56:45 +00:00
})
}
{
notesMeta.length > 10 &&
<div className={''}>
<Link href='/notes'>
<a className='h5'>More...</a>
</Link>
</div>
}
</div>
2022-04-28 16:37:12 +00:00
);
}
export default RecentNotes;