mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
add catalog view
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import styles from './catalog-row.module.css';
|
||||
import { Comment } from '@plebbit/plebbit-react-hooks';
|
||||
|
||||
const CatalogPost = ({ post }: { post: Comment }) => {
|
||||
const { title, cid } = post || {};
|
||||
|
||||
return <div className={styles.post}>{title || 'this is a post without a title'}</div>;
|
||||
};
|
||||
|
||||
interface CatalogRowProps {
|
||||
description: any | undefined;
|
||||
index: number;
|
||||
rules: any | undefined;
|
||||
row: Comment[];
|
||||
}
|
||||
|
||||
const CatalogRow = ({ description, index, row, rules }: CatalogRowProps) => {
|
||||
const rowPosts = index === 0 ? [...(rules?.content?.length > 0 ? [rules] : []), ...(description?.content?.length > 0 ? [description] : []), ...row] : row;
|
||||
|
||||
const posts = rowPosts.map((post, index) => <CatalogPost key={index} post={post} />);
|
||||
|
||||
return <div className={styles.row}>{posts}</div>;
|
||||
};
|
||||
|
||||
export default CatalogRow;
|
||||
Reference in New Issue
Block a user