diff --git a/src/app/page.tsx b/src/app/page.tsx index 9f47ef8..64ba64e 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -1,10 +1,11 @@ import React from 'react'; import PostFeed from '@/components/post-feed'; +import * as testData from '../../test-data.json'; const Feed = () => (
- +
); diff --git a/src/app/user/[userslug]/page.tsx b/src/app/user/[userslug]/page.tsx index 421923a..4ac5e4c 100644 --- a/src/app/user/[userslug]/page.tsx +++ b/src/app/user/[userslug]/page.tsx @@ -28,7 +28,7 @@ const User = () => ( - + ); diff --git a/src/components/moderates-list/index.tsx b/src/components/moderates-list/index.tsx index cc096b1..e367bdc 100644 --- a/src/components/moderates-list/index.tsx +++ b/src/components/moderates-list/index.tsx @@ -14,7 +14,7 @@ export const ModeratesListItem = (props: ModeratesListItemProps) => { const { communityName, communityAvatar, url } = props; return ( - + {communityAvatar && ( ( -
- - - {tabs.map(({ label, value }) => ( - - {label} - - ))} - - - {tabs.map(({ value }) => ( - - TODO: - {' '} - {value} - - ))} - - -
-); +export const PersonDetailSelection = ({ postViews }: PersonDetailSelectionProps) => { + const tabs: { + label: string; + value: string; + content?: React.JSX.Element; + }[] = [ + { label: 'Posts', value: 'posts', content: }, + { label: 'Comments', value: 'comments' } + ]; + + return ( +
+ + + {tabs.map(({ label, value }) => ( + + {label} + + ))} + + + {tabs.map(({ value, content }) => ( + + {content || `TODO: ${value}`} + + ))} + + +
+ ); +}; diff --git a/src/components/post-feed/index.tsx b/src/components/post-feed/index.tsx index 30d34d7..56191a3 100644 --- a/src/components/post-feed/index.tsx +++ b/src/components/post-feed/index.tsx @@ -1,17 +1,28 @@ import React from 'react'; -import * as testData from '../../../test-data.json'; +import { Community, Post, PostAggregates } from 'sublinks-js-client'; import { PostCard } from '../post'; +import { H1 } from '../text'; -const PostFeed = () => ( +interface PostFeedProps { + data: { + post: Post; + counts: PostAggregates; + community: Community; + }[] +} + +const PostFeed = ({ data: posts }: PostFeedProps) => (
- {testData.posts.map(postData => ( - - ))} + {posts && posts.length > 0 ? posts.map(postData => ( +
+ +
+ )) : (

No posts available!

)}
);