2023-08-05 14:46:03 -04:00
|
|
|
export const title = "Blog";
|
2023-08-06 11:04:01 -04:00
|
|
|
export const description = "Hello, stranger. Stay a while and listen.";
|
2023-08-05 14:46:03 -04:00
|
|
|
|
2024-03-05 18:38:42 -05:00
|
|
|
export default function ({ nav, comp }) {
|
2023-08-26 21:26:19 -04:00
|
|
|
const { PostListItem } = comp;
|
|
|
|
|
2024-03-05 18:38:42 -05:00
|
|
|
const sortPosts = (a, b) => {
|
2023-08-05 14:46:03 -04:00
|
|
|
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">
|
2024-03-05 18:38:42 -05:00
|
|
|
<img
|
2024-03-11 15:57:14 -04:00
|
|
|
src="https://static.fosterhangdaan.com/icons/tabler-icons/v2.47.0/svg/coffee.svg"
|
2024-03-05 18:38:42 -05:00
|
|
|
className="icon"
|
|
|
|
alt=""
|
|
|
|
/>
|
2023-08-06 11:04:01 -04:00
|
|
|
<h2>No posts yet</h2>
|
2024-03-05 18:38:42 -05:00
|
|
|
<p>
|
|
|
|
Foster is on a coffee break.<br />Check back later.
|
|
|
|
</p>
|
2023-08-05 14:46:03 -04:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
<ul className="post-list">
|
2024-03-05 18:38:42 -05:00
|
|
|
{nav.menu("/blog/posts").children.sort(sortPosts).map((post, index) => (
|
|
|
|
<PostListItem key={index} post={post} />
|
|
|
|
))}
|
2023-08-05 14:46:03 -04:00
|
|
|
</ul>
|
|
|
|
);
|
|
|
|
}
|