import React from 'react';
import {PostType, UserType} from '../../types';
import {Post} from '../common';
import {AuthContext} from '../../routes/authentication';

interface FeedProps {
  user: UserType;
}
const Feed: React.FC<FeedProps> = ({user}) => {
  const {instaPosts} = React.useContext(AuthContext);
  const posts: Array<PostType> = [];
  for (let i = 0; i < 10; i++) {
    const testPost: PostType = {
      owner: user,
      social: 'Instagram',
      socialHandle: 'igHandle',
      data: instaPosts[i],
    };
    posts.push(testPost);
  }
  return (
    <>
      {posts.map((post, index) => (
        <Post key={index} post={post} />
      ))}
    </>
  );
};

export default Feed;
