blob: 90cce610fdf30093f8f144a0d2278430071a8d31 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
---
import translate from '$i18n/translate';
import tNewsPreviewLink from '$i18n/translations/components/newsPreviewLink';
import getLocaleFromPath from '$lib/getLocaleFromPath';
import type { CollectionEntry } from 'astro:content';
interface Props {
headingLevel: 'h1' | 'h2' | 'h3' | 'h4';
newsItem: CollectionEntry<'news'>;
}
const { headingLevel, newsItem } = Astro.props;
const locale = getLocaleFromPath(Astro.url.pathname);
const t = translate(locale);
---
<a class="news-index__item group-hover" href={`/${locale}/news/${newsItem.slug.replace('/', '-')}`}>
<Fragment
set:html={`
<${headingLevel}>${newsItem.data.title}</${headingLevel}>
`}
/>
<p>{newsItem.data.summary}</p>
<p class="link">{t(tNewsPreviewLink, { key: 'read-article' })}</p>
</a>
|