import Typography from "@/shared/ui/components/Typography/Typography"; import "./NewsDetails.scss"; import { apiInstance } from "@/shared/config/apiConfig"; import { INews } from "@/shared/types/news-type"; import Image from "next/image"; import message from "./icons/message.svg"; import calendar from "./icons/calendar.svg"; import ReviewSection from "@/widgets/ReviewSection/ReviewSection"; const NewsDetails = async ({ params, }: { params: { id: string }; }) => { const getNewsById = async () => { const response = await apiInstance.get( `/news/${params.id}/` ); return response.data; }; const data = await getNewsById(); const months: Record = { "01": "Январь", "02": "Февраль", "03": "Март", "04": "Апрель", "05": "Май", "06": "Июнь", "07": "Июль", "08": "Август", "09": "Сентябрь", "10": "Октябрь", "11": "Ноябрь", "12": "Декабрь", }; return (
{data.title}
News Image
Calendar Icon

{months[data.created_at.slice(5, 7)]}{" "} {data.created_at.slice(5, 7).slice(0, 1) === "0" ? data.created_at.slice(6, 7) : data.created_at.slice(5, 7)} , {data.created_at.slice(0, 4)}

Message Icon

Комментарии: {data.count_reviews}

{data.title}

{data.description}

); }; export default NewsDetails;