From 19a464fcb234a3e8c0cd8d87f55a931693e1572c Mon Sep 17 00:00:00 2001 From: Oliver Barnwell Date: Thu, 13 Jun 2024 15:14:37 +0100 Subject: [PATCH] show a no posts available message to our users --- content/posts/hello-world.md | 11 ------ src/pages/posts/index.page.tsx | 64 ++++++++++++++++++---------------- 2 files changed, 34 insertions(+), 41 deletions(-) delete mode 100644 content/posts/hello-world.md diff --git a/content/posts/hello-world.md b/content/posts/hello-world.md deleted file mode 100644 index 74312ab4d..000000000 --- a/content/posts/hello-world.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -title: 'Mapping Public Toilets' -author: 'Ollie' -date: 2024-04-16T19:31:20.591Z -profilePictureUrl: https://avatars.githubusercontent.com/u/1771189?v=4 -profileSocialUrl: https://olliethinks.co.uk/ ---- - -Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus vitae placerat leo, non posuere justo. Nulla facilisi. Vivamus ac tempus justo, a volutpat eros. Ut felis magna, semper nec felis non, finibus euismod eros. Vestibulum congue tellus ut augue mattis ullamcorper. Sed et libero eget sapien sollicitudin auctor. Maecenas accumsan pretium neque sed euismod. Nam facilisis felis a massa blandit dictum. Maecenas finibus pretium odio id aliquam. Aenean vel odio nec tellus rutrum hendrerit a quis nisi. - -Quisque sapien justo, auctor sed interdum vitae, luctus at risus. Sed luctus hendrerit metus, eu laoreet turpis fringilla sed. Donec justo risus, aliquam id augue in, aliquet finibus nisi. Cras mollis quam et ex tempus, sit amet tincidunt nulla lacinia. Proin sem ipsum, luctus eget odio non, gravida euismod neque. Fusce turpis odio, suscipit nec dolor faucibus, mattis lobortis lorem. Fusce faucibus neque a mollis feugiat. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Sed auctor venenatis lectus, eget aliquam mauris maximus quis. Proin eleifend dui quis auctor commodo. Aliquam erat volutpat. Donec vestibulum tortor odio, non vestibulum justo pretium et. Sed sit amet accumsan lorem, in tincidunt purus. Aenean non urna dapibus, faucibus diam at, interdum nibh. diff --git a/src/pages/posts/index.page.tsx b/src/pages/posts/index.page.tsx index 19f16ab4b..1807474a2 100644 --- a/src/pages/posts/index.page.tsx +++ b/src/pages/posts/index.page.tsx @@ -19,9 +19,6 @@ type Props = { }; export const getStaticProps: GetStaticProps = (async () => { - for (let i = 0; i < 10; i++) { - allPosts.push(allPosts[0]); - } return { props: { posts: allPosts } }; }) satisfies GetStaticProps; @@ -35,6 +32,7 @@ const PostWrapper = styled(Box)` export default function PostPage({ posts, }: InferGetStaticPropsType) { + const postsAvailable = posts && posts.length > 0; return ( @@ -46,38 +44,44 @@ export default function PostPage({ - {posts.map((postData, i) => ( - - +

Our blog is currently out of paper—check back soon!

+ + )} + {postsAvailable && + posts.map((postData, i) => ( + - -

{postData.title}

-
- - - {postData.author} + +

{postData.title}

+
- - - - + + + {postData.author} + + + + + +
-
- ))} + ))}