import { url } from "../../App"; import { Link } from "react-router-dom"; import { Card, CardHeader, CardContent, CardActions, Avatar, IconButton, Typography, Box, Divider, TextField } from '@mui/material' import { FavoriteBorderRounded, Send, ChatBubbleOutline, TurnedInNot, AccountCircle } from '@mui/icons-material/' import Grid from '@mui/material/Unstable_Grid2'; export function CardPost({ postData }) { // console.log('test: ', postData) // дата поста const dateofPost = new Date(+postData.createdAt) const months = ['января', 'февраля', 'марта', 'апреля', 'мая', 'июня', 'июля', 'августа', 'сентября', 'октября', 'ноября', 'декабря'] const dateofPostParse = `${dateofPost.getDate() < 10 ? '0' + dateofPost.getDate() : dateofPost.getDate()} ${months[dateofPost.getMonth()]} ${dateofPost.getFullYear()} ${dateofPost.getHours()}:${dateofPost.getMinutes() < 10 ? '0' + dateofPost.getMinutes() : dateofPost.getMinutes()}` return ( } title={ {postData?.owner?.login} } subheader={dateofPostParse} /> {/* */} {/* */} {/* */} {postData.title} {postData.text} {/* */} Нравится: {postData.likesCount ? postData.likesCount : '0'} {/* Нравится: {postData.likesCount || '0'} // сработает или нет - проверить */} ) }