diff options
| author | Joe Carstairs <jcarstairs@scottlogic.com> | 2023-08-15 17:50:43 +0100 |
|---|---|---|
| committer | Joe Carstairs <jcarstairs@scottlogic.com> | 2023-08-15 17:50:43 +0100 |
| commit | 83144491ded4bb483bf74125794294c58b193b7e (patch) | |
| tree | 69c89b20f28adee7e5631b8b433223fe077f9fb5 /src/components | |
| parent | a28cf885d5cac5d17bae7586ff88ea5e82bd70ff (diff) | |
Pulls out NewsPreviewLink
Diffstat (limited to 'src/components')
| -rw-r--r-- | src/components/NewsPreviewLink.astro | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/components/NewsPreviewLink.astro b/src/components/NewsPreviewLink.astro new file mode 100644 index 0000000..99ecb60 --- /dev/null +++ b/src/components/NewsPreviewLink.astro @@ -0,0 +1,20 @@ +--- +import translate from '$i18n/translate'; +import tNewsPreviewLink from '$i18n/translations/components/newsPreviewLink'; +import type Locale from '$types/Locale'; +import type { CollectionEntry } from 'astro:content'; + +interface Props { + locale: Locale; + newsItem: CollectionEntry<'news'>; +} + +const { locale, newsItem } = Astro.props; +const t = translate(locale); +--- + +<a class="news-index__item" href={`/${locale}/news/${newsItem.slug.replace('/', '-')}`}> + <h2>{newsItem.data.title}</h2> + <p>{newsItem.data.summary}</p> + <p class="link">{t(tNewsPreviewLink, { key: 'read-article' })}</p> +</a> |
