diff options
Diffstat (limited to 'src/components/Feed')
-rw-r--r-- | src/components/Feed/Feed.tsx | 63 |
1 files changed, 0 insertions, 63 deletions
diff --git a/src/components/Feed/Feed.tsx b/src/components/Feed/Feed.tsx deleted file mode 100644 index bf3c5b7..0000000 --- a/src/components/Feed/Feed.tsx +++ /dev/null @@ -1,63 +0,0 @@ -import React from 'react'; -import { Poll } from 'which-types'; -import { WindowScroller, AutoSizer, List } from 'react-virtualized'; -import PollCard from '../PollCard/PollCard'; - - -interface PropTypes { - polls: Poll[]; -} - -interface RenderPropTypes { - index: number; - key: string; - style: React.CSSProperties; -} - - -const Feed: React.FC<PropTypes> = ({ polls }) => { - const RenderItem: React.FC<RenderPropTypes> = ({ index, style, key }) => { - const poll = polls[index]; - return ( - // To re-render on list resize, add this info to key - <div key={key + polls.length} style={style}> - <PollCard initialPoll={poll} /> - </div> - ); - }; - - return ( - <WindowScroller> - {({ - height, - isScrolling, - registerChild, - onChildScroll, - scrollTop - }) => ( - <AutoSizer disableHeight> - {({ width }) => ( - <div ref={registerChild}> - <List - autoHeight - height={height} - isScrolling={isScrolling} - onScroll={onChildScroll} - rowCount={polls.length} - rowHeight={550} - rowRenderer={RenderItem} - scrollTop={scrollTop} - width={width} - containerStyle={{ pointerEvents: 'auto' }} - overscanRowCount={1} - /> - </div> - )} - </AutoSizer> - )} - </WindowScroller> - ); -}; - -export default Feed; - |