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,
      instagram: instaPosts[i],
      social: 'Instagram',
    };
    posts.push(testPost);
  }
  return (
    <>
      {posts.map((post, index) => (
        <Post key={index} post={post} />
      ))}
    </>
  );
};

export default Feed;
