From d7d5084ca2f8ac16c5a7b592e5dad6b856a1bd23 Mon Sep 17 00:00:00 2001 From: Max Richter Date: Sun, 23 Feb 2025 14:31:14 +0100 Subject: [PATCH] feat: add icons to posts and photos to featured posts --- src/components/SmallCard.astro | 8 +++++++- src/content/photos/erasmus-valencia/index.en.mdx | 4 ++-- src/content/photos/erasmus-valencia/index.mdx | 4 ++-- src/content/photos/madeira-2025/index.en.mdx | 4 ++-- src/content/photos/madeira-2025/index.mdx | 4 ++-- .../photos/peaks-of-the-balkans/index.en.mdx | 4 ++-- .../photos/peaks-of-the-balkans/index.mdx | 4 ++-- src/pages/index.astro | 16 ++++++++++++++-- 8 files changed, 33 insertions(+), 15 deletions(-) diff --git a/src/components/SmallCard.astro b/src/components/SmallCard.astro index 219fdcc..e4a44f4 100644 --- a/src/components/SmallCard.astro +++ b/src/components/SmallCard.astro @@ -21,7 +21,13 @@ const { post } = Astro.props;

- {post.data.icon && } + { + post.data.icon?.length > 3 ? ( + + ) : post.data.icon?.length ? ( + {post.data.icon} + ) : null + } {post.data.title}

diff --git a/src/content/photos/erasmus-valencia/index.en.mdx b/src/content/photos/erasmus-valencia/index.en.mdx index aa75eb1..2bafb22 100644 --- a/src/content/photos/erasmus-valencia/index.en.mdx +++ b/src/content/photos/erasmus-valencia/index.en.mdx @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d88b51df733ac9980c4ca59a1282fd95d06869520e0e28f59907d85a8118c867 -size 3380 +oid sha256:2ab00c05cff49c5929171beb7546acb3e395719b6ea9424a34aa4297cf658f9d +size 3431 diff --git a/src/content/photos/erasmus-valencia/index.mdx b/src/content/photos/erasmus-valencia/index.mdx index a85fb36..e8106e6 100644 --- a/src/content/photos/erasmus-valencia/index.mdx +++ b/src/content/photos/erasmus-valencia/index.mdx @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:466b2331d98bb877912b2e1a9e95242cd19c824b6fd52c5cf5800fa19d0203bd -size 3451 +oid sha256:fc354fd149a88514e1283d8c919a630c0d3f3b5336893cc383ef8ca80b1e56b8 +size 3492 diff --git a/src/content/photos/madeira-2025/index.en.mdx b/src/content/photos/madeira-2025/index.en.mdx index a9e219f..ee1fd9c 100644 --- a/src/content/photos/madeira-2025/index.en.mdx +++ b/src/content/photos/madeira-2025/index.en.mdx @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1db79d91f27d084f20d3da09b6b5ecd022abe59c5d44663787829ff40a7330d6 -size 5899 +oid sha256:d898fb58ec8642908a54624209f8e76ffaec5807c809a56bd1252e5c9ebe3159 +size 5941 diff --git a/src/content/photos/madeira-2025/index.mdx b/src/content/photos/madeira-2025/index.mdx index 765ef58..2268c80 100644 --- a/src/content/photos/madeira-2025/index.mdx +++ b/src/content/photos/madeira-2025/index.mdx @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:fd3949d3d59b7b09265f4f447323bd9f940fac4c43031dbf07f070506a2cacb0 -size 6045 +oid sha256:b9bcbbf29dfae9be1985facda80617a10fcdcc820de7cb0547017de5e8ffdb9b +size 6087 diff --git a/src/content/photos/peaks-of-the-balkans/index.en.mdx b/src/content/photos/peaks-of-the-balkans/index.en.mdx index 5c8c40b..db5f953 100644 --- a/src/content/photos/peaks-of-the-balkans/index.en.mdx +++ b/src/content/photos/peaks-of-the-balkans/index.en.mdx @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6544971166ce44a56b31c5761a08eac45f678b4cc0003eef8dd6d4651af06aa7 -size 7698 +oid sha256:0a5dd64811bca9ba17ab38d14541d856eb83691685156360e70e561523eb2db8 +size 7740 diff --git a/src/content/photos/peaks-of-the-balkans/index.mdx b/src/content/photos/peaks-of-the-balkans/index.mdx index a0af893..ec111eb 100644 --- a/src/content/photos/peaks-of-the-balkans/index.mdx +++ b/src/content/photos/peaks-of-the-balkans/index.mdx @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:104bbe87664e3f491593a26a0a5a3a6d701a1ae209c4fd977c01db4a5d94e8d0 -size 7697 +oid sha256:63d6aecd47ae12c94fb9488e2ab82529dba29e428f9007aed9923294bdd93fe7 +size 7749 diff --git a/src/pages/index.astro b/src/pages/index.astro index dc42237..9cec2ad 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -33,9 +33,21 @@ const posts = filterCollection( await getCollection("blog"), getLocale(Astro.url), ); +const photos = filterCollection( + await getCollection("photos"), + getLocale(Astro.url), +); +const list = [...posts, ...photos]; +list.sort((a, b) => { + return a.data.date > b.data.date ? -1 : 1; +}); +// .sort((a, b) => { +// return a.data.date.getDate() > b.data.date.getDate() ? 1 : -1; +// }); +console.log(list.map((post) => [post.data.date, post.data.title])); -const featuredPost = posts.find((post) => post.data?.featured); -const otherPosts = posts.filter((post) => featuredPost !== post).slice(0, 3); +const featuredPost = list.find((post) => post.data?.featured); +const otherPosts = list.filter((post) => featuredPost !== post).slice(0, 3); ---