From 869976b711d862581d1d99bf884dd166b1ecdf3b Mon Sep 17 00:00:00 2001 From: Joe Carstairs <65492573+Sycamost@users.noreply.github.com> Date: Sun, 20 Aug 2023 07:57:21 +0100 Subject: Pulls out NewsIndex Astro component --- src/pages/[locale]/index.astro | 18 +++++++++++------- src/pages/[locale]/news/index.astro | 12 ++---------- 2 files changed, 13 insertions(+), 17 deletions(-) (limited to 'src/pages') diff --git a/src/pages/[locale]/index.astro b/src/pages/[locale]/index.astro index 11188a0..e5e6040 100644 --- a/src/pages/[locale]/index.astro +++ b/src/pages/[locale]/index.astro @@ -5,8 +5,8 @@ import translate from '$i18n/translate'; import tPage from '$i18n/translations/pages/home'; import type Locale from '$types/Locale'; import { getMostRecentNewsItem } from '$lib/newsUtils'; -import NewsPreviewLink from '$components/NewsPreviewLink.astro'; import contactDetails from '$data/contactDetails'; +import NewsIndex from '$components/NewsIndex/NewsIndex.astro'; export async function getStaticPaths() { return localeStaticPaths; @@ -20,12 +20,16 @@ const mostRecentNewsItem = await getMostRecentNewsItem(locale);

- {mostRecentNewsItem && } - + + { + mostRecentNewsItem && ( + + ) + }

diff --git a/src/pages/[locale]/news/index.astro b/src/pages/[locale]/news/index.astro index 8a6e322..6e95884 100644 --- a/src/pages/[locale]/news/index.astro +++ b/src/pages/[locale]/news/index.astro @@ -5,8 +5,8 @@ import Page from '$layouts/Page.astro'; import getLocaleFromPath from '$lib/getLocaleFromPath'; import localeStaticPaths from '$lib/localeStaticPaths'; import { getCollection } from 'astro:content'; -import NewsPreviewLink from '$components/NewsPreviewLink.astro'; import { isNewsItemInLocale } from '$lib/newsUtils'; +import NewsIndex from '$components/NewsIndex/NewsIndex.astro'; const allNews = await getCollection('news'); const locale = getLocaleFromPath(Astro.url.pathname); @@ -21,14 +21,6 @@ export async function getStaticPaths() {

{t(tPage, { key: 'title' })}

-
- { - allNewsInLocale.length > 0 ? ( - allNewsInLocale.map((item) => ) - ) : ( -

{t(tPage, { key: 'no-news' })}

- ) - } -
+
-- cgit v1.2.3