32 lines
812 B
TypeScript
32 lines
812 B
TypeScript
import { SectionHeader } from "../general/SectionHeader";
|
|
import { NewsItem } from "./NewsItem";
|
|
import styles from "./newsList.module.scss";
|
|
import { NewsFragment } from "@/lib/news";
|
|
|
|
export const NewsList = ({
|
|
news,
|
|
heading,
|
|
featured,
|
|
limit,
|
|
}: {
|
|
news: NewsFragment[];
|
|
heading?: string;
|
|
featured?: boolean;
|
|
limit?: number;
|
|
}) => {
|
|
const filteredNews = limit ? news.slice(0, limit) : news;
|
|
|
|
return (
|
|
<section className={styles.newsWrapper}>
|
|
{heading && (
|
|
<SectionHeader heading={heading} link="/aktuelt" linkText="Se flere artikler" />
|
|
)}
|
|
<ul className={`${styles.newsList} ${featured && styles.featured}`}>
|
|
{filteredNews.map((singleNews) => (
|
|
<NewsItem key={singleNews.id} news={singleNews} />
|
|
))}
|
|
</ul>
|
|
</section>
|
|
);
|
|
};
|