-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathNewsCard.tsx
More file actions
49 lines (45 loc) · 1.48 KB
/
NewsCard.tsx
File metadata and controls
49 lines (45 loc) · 1.48 KB
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import { memo } from 'react';
import { classNames } from '@/shared/lib/classNames/classNames';
import cls from './NewsCard.module.scss';
import Image from 'next/image';
import Link from 'next/link';
interface NewsCardProps {
className?: string;
title: string;
previewText: string;
date: string;
id: number;
titlePicture?: string;
}
const NewsCard = (props: NewsCardProps) => {
const { title, date, id, previewText, titlePicture } = props;
const picture = titlePicture;
return (
<Link
rel="id"
href={`/news/${id}`}
className={classNames(cls.NewsCardLink)}
>
<div className={classNames(cls.NewsCard, {})}>
<div className={cls.content}>
<h2 className={cls.title}>{title}</h2>
<p className={cls.text}>{previewText}</p>
<span className={cls.date}>{date}</span>
<div className={cls.imageContainer}>
{picture && (
<Image
src={picture}
alt={title}
className={cls.image}
width={100}
height={600}
/>
)}
</div>
</div>
</div>
</Link>
);
};
NewsCard.displayName = 'NewsCard';
export default memo(NewsCard);