kgroad-frontend2/src/Widgets/NewsSection/NewsSection.tsx

36 lines
1.1 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import "./NewsSection.scss";
import Image from "next/image";
import Link from "next/link";
import { getNews } from "./newsSectionStore";
import SectionHeader from "@/entities/SectionHeader/SectionHeader";
import arrow_icon from "./icons/arrow-right.svg";
import NewsCard from "@/entities/NewsCard/NewsCard";
const NewsSection = async () => {
const news = await getNews();
return (
<section className="news-section">
<SectionHeader title="Новости" />
<ul className="news-section__list">
{news?.map((article) => (
<li key={article.id} className="news-section__card">
<NewsCard
id={article.id}
title={article.title}
image={article.image}
description={article.description}
date={article.created_at}
/>
</li>
))}
</ul>
<Link href="/news" className="news-section__read-more-btn">
Читать
<Image src={arrow_icon} alt="Arrow Right Icon" />
</Link>
</section>
);
};
export default NewsSection;