Files
5chan/src/components/post/post.tsx
T

33 lines
1.1 KiB
TypeScript
Raw Normal View History

2024-03-22 15:31:02 +01:00
import { Comment } from '@plebbit/plebbit-react-hooks';
import styles from './post.module.css';
import useReplies from '../../hooks/use-replies';
import { getLinkMediaInfoMemoized } from '../../lib/utils/media-utils';
2024-03-22 15:31:02 +01:00
const Post = ({ post }: Comment) => {
const { content, link, title } = post;
const replies = useReplies(post);
const linkMediaInfo = getLinkMediaInfoMemoized(link);
2024-03-22 15:31:02 +01:00
return (
<div className={styles.thread}>
2024-03-22 15:31:02 +01:00
<hr />
<div className={styles.postContainer}>
<div className={styles.postDesktop}>
{linkMediaInfo?.url && (
<div className={styles.link}>
Link:{' '}
<a href={linkMediaInfo?.url} target='_blank' rel='noopener noreferrer'>
{linkMediaInfo.url.length > 30 ? linkMediaInfo?.url.slice(0, 30) + '...' : linkMediaInfo?.url}
</a>{' '}
({linkMediaInfo?.type})
</div>
)}
<div className={styles.postInfo}></div>
<div className={styles.postMessage}></div>
</div>
</div>
2024-03-22 15:31:02 +01:00
</div>
);
};
export default Post;