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