Skip to content

Commit

Permalink
#15 Add post component to post page
Browse files Browse the repository at this point in the history
  • Loading branch information
SandraBergstrom committed Jun 24, 2023
1 parent 121f82e commit 4c754dd
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions src/pages/posts/Post.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import React from "react";
import {useCurrentUser} from "../../contexts/CurrentUserContext"

import styles from "../../styles/Post.module.css";
import Card from 'react-bootstrap/Card';
import { Media } from "react-bootstrap";
import { Link } from "react-router-dom";
import Avatar from "../../components/Avatar"

const Post = (props) => {
const {
id,
owner,
traveler_id,
traveler_image,
comments_count,
likes_count,
like_id,
title,
content,
image,
updated_at,
postPage,
} = props;

const currentUser = useCurrentUser;
const is_owner = currentUser?.username === owner;

return (
<Card className={styles.Post}>
<Card.Body>
<Media className="align-items-center justify-content-between">
<Link to={`/travelers/${traveler_id}`}>
<Avatar src={traveler_image} height={55} />
</Link>
</Media>
</Card.Body>
</Card>
);
};

export default Post;

0 comments on commit 4c754dd

Please sign in to comment.