aboutsummaryrefslogtreecommitdiff
path: root/src/components/Feed/Feed.tsx
blob: d81da99a7f47a564d7917961720d13d208fe986c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import React from 'react';
import { makeStyles } from '@material-ui/core/styles';
import { Poll } from 'which-types';
import PollCard from '../PollCard/PollCard';

interface PropTypes {
  polls: Poll[];
  navigate: (prefix: string, id: string) => void;
}

const useStyles = makeStyles(theme => ({
  root: {
    position: 'relative',
    maxWidth: theme.spacing(75),
    margin: '0 auto'
  }
}));

const Feed: React.FC<PropTypes> = ({ polls, navigate }) => {
  const classes = useStyles();

  return (
    <div className={classes.root}>
      {polls.map(poll => <PollCard initialPoll={poll} key={poll._id} navigate={navigate} />)}
    </div>
  );
};

export default Feed;