date fixed

This commit is contained in:
Kakabay 2023-03-07 17:24:12 +05:00
parent d77ac9486c
commit 4839f66854
1 changed files with 19 additions and 27 deletions

View File

@ -1,23 +1,24 @@
// Modules
import { Link } from "react-router-dom";
import { LazyLoadImage } from "react-lazy-load-image-component";
import { v4 as uuidv4 } from "uuid";
import ReactPlayer from "react-player";
import { Link } from 'react-router-dom';
import { LazyLoadImage } from 'react-lazy-load-image-component';
import { v4 as uuidv4 } from 'uuid';
import ReactPlayer from 'react-player';
// Components
import NewsCategory from "../global/NewsCategory";
import NewsDate from "../global/NewsDate";
import { IPostsData } from "../../types/data.types";
import placeholder from "../../assets/images/placeholder.webp";
import NewsCategory from '../global/NewsCategory';
import NewsDate from '../global/NewsDate';
import { IPostsData } from '../../types/data.types';
import placeholder from '../../assets/images/placeholder.webp';
import { dateParse } from '../../helpers/dateParser';
interface Props {
id: IPostsData["id"];
title: IPostsData["title"];
text: IPostsData["content_html"];
categories: IPostsData["categories"];
date: IPostsData["published_at"];
img: IPostsData["featured_images"][0]["path"];
video: IPostsData["video"];
id: IPostsData['id'];
title: IPostsData['title'];
text: IPostsData['content_html'];
categories: IPostsData['categories'];
date: IPostsData['published_at'];
img: IPostsData['featured_images'][0]['path'];
video: IPostsData['video'];
}
const News = ({ id, title, text, categories, date, img, video }: Props) => {
@ -26,13 +27,7 @@ const News = ({ id, title, text, categories, date, img, video }: Props) => {
<div className="news-wrapper">
<div className="news-image">
{video && video.length > 0 ? (
<ReactPlayer
url={video}
controls
light={img}
width="100%"
height="100%"
/>
<ReactPlayer url={video} controls light={img} width="100%" height="100%" />
) : (
<LazyLoadImage
src={img}
@ -53,13 +48,10 @@ const News = ({ id, title, text, categories, date, img, video }: Props) => {
})}
</div>
<div className="news-status-right">
<NewsDate date={date} />
<NewsDate date={dateParse(date)} />
</div>
</div>
<div
className="news-text"
dangerouslySetInnerHTML={{ __html: text }}
></div>
<div className="news-text" dangerouslySetInnerHTML={{ __html: text }}></div>
</div>
</div>
</div>