website/blog/index.tsx
Foster Hangdaan 4b8e72b1d6
Pin icon images to specific version
Instead of using the `latest` version, which could introduce breaking changes.
2024-03-11 15:57:14 -04:00

41 lines
944 B
TypeScript

export const title = "Blog";
export const description = "Hello, stranger. Stay a while and listen.";
export default function ({ nav, comp }) {
const { PostListItem } = comp;
const sortPosts = (a, b) => {
if (a.data.date < b.data.date) {
return 1;
} else if (a.data.date > b.data.date) {
return -1;
} else {
return 0;
}
};
if (!nav.menu("/blog/posts")) {
return (
<div className="no-posts">
<img
src="https://static.fosterhangdaan.com/icons/tabler-icons/v2.47.0/svg/coffee.svg"
className="icon"
alt=""
/>
<h2>No posts yet</h2>
<p>
Foster is on a coffee break.<br />Check back later.
</p>
</div>
);
}
return (
<ul className="post-list">
{nav.menu("/blog/posts").children.sort(sortPosts).map((post, index) => (
<PostListItem key={index} post={post} />
))}
</ul>
);
}