46 lines
1.6 KiB
JavaScript
46 lines
1.6 KiB
JavaScript
import React from 'react';
|
||
import './style.css'
|
||
import styled from 'styled-components';
|
||
import { HttpApiMethods } from '../fetchUtils/FetchUtils';
|
||
import EditForm from '../post/PostForm';
|
||
|
||
|
||
|
||
const httpApiMethods = new HttpApiMethods()
|
||
|
||
const meets = await httpApiMethods.GetMeetings()
|
||
|
||
const Home = () => {
|
||
|
||
function extractDateTime(dateString) {
|
||
const dateTime = new Date(dateString);
|
||
const date = dateTime.toLocaleDateString();
|
||
const time = dateTime.toLocaleTimeString();
|
||
|
||
return { date, time };
|
||
}
|
||
|
||
return (
|
||
<div className='wrapp'>
|
||
{Array.isArray(meets) ? (
|
||
meets.map((item, index) => (
|
||
<div className='event_card' key={index}>
|
||
<div className="event-card__photo"><img className='img' src={httpApiMethods.APIURL_FILES + item.speackerImage} alt="{item.speackerImage}" /></div>
|
||
<div className="taggs">
|
||
<div className='tagged'>{item.tags}</div>
|
||
<div className="feautures">{item.type}</div>
|
||
</div>
|
||
<h4 className="event-card__title">{item.title}</h4>
|
||
<p className="event-card__date">{extractDateTime(item.time).date}, в {extractDateTime(item.time).time} по Московскому времени</p>
|
||
</div>
|
||
))
|
||
) : (
|
||
<p>Неверный тип данных с сервера!</p>
|
||
)}
|
||
{/* <EditForm></EditForm> */}
|
||
</div>
|
||
);
|
||
}
|
||
|
||
export default Home;
|