JS React
Помогите пожалуйста создать код постов как в инстаграме с фото лайками и т.д в tsx css
Ответы
Ответ:
import React from 'react';
type PostProps = {
username: string;
location: string;
imageUrl: string;
likes: number;
caption: string;
};
const Post: React.FC<PostProps> = ({ username, location, imageUrl, likes, caption }) => {
return (
<div className="post">
<header>
<div className="post-user">
<div className="post-user-avatar">
{/* Insert user avatar image here */}
</div>
<div className="post-user-info">
<span className="post-username">{username}</span>
<span className="post-location">{location}</span>
</div>
</div>
</header>
<div className="post-image">
<img src={imageUrl} alt={caption} />
</div>
<div className="post-actions">
{/* Insert like, comment, and share buttons here */}
</div>
<div className="post-likes">{likes} likes</div>
<div className="post-caption">{caption}</div>
</div>
);
};
export default Post;